Friday, March 28, 2014

Get number of rows from user and print Triangle

OUTPUT Example :

***********
**********
*********
********
*******
******
*****
****
***
**
*
Source Code

#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 a,b,c;

printf("\nEnter Number of rows : ",c);
scanf("%d",c);
void line();
printf("\n");
for (a=1;a<=10;a++)
{
    for(b=a;b<=10;b++)
        printf("*");
        printf("\n");
}

line();
return 0;
}

No comments:

Post a Comment