Friday, March 28, 2014

print the asteriks triangle using three for loops

#include<stdio.h>
#include<stdlib.h>
void line()
{
int i,j;
printf("\n");
for(i=1;i<=42;i++)
printf("=");
}
void header()
{
printf("\n");
printf("Built and Designed by Arslan Malik\n\n www.CworldbyAS.blogspot.com");
printf("\n");
}
int main()
{
line();
header();
line();

int i,j,k;
for(i=10;i>=1;i--)
{
    printf(" \n");
    for(j=1;j<=10-i;j++)
    {printf(" ");}
    for (k=1;k<=i;k++)
    {
        printf("*");
    }


}

return 0;
}

No comments:

Post a Comment