C programming examples with output
Asterisks Graph
Program
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,rows;
clrscr();
printf("Enter number of rows :");
scanf("%d",&rows);
for(i=1;i<=rows;i++)
{
for(j=1;j<=1;j++)
{
printf("* ");
}
printf("\n");
}
getch();
}
Output:
Enter number of rows:7
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
Asterisks Graph
Program
#include<stdio.h>
#include<conio.h>
main()
{
int i,j,rows;
clrscr();
printf("Enter number of rows :");
scanf("%d",&rows);
for(i=1;i<=rows;i++)
{
for(j=1;j<=1;j++)
{
printf("* ");
}
printf("\n");
}
getch();
}
Output:
Enter number of rows:7
*
* *
* * *
* * * *
* * * * *
* * * * * *
* * * * * * *
0 komentar:
Post a Comment