This is my first program.Example with output screenshot .
#include <stdio.h>
int main()
{
int i, j, row;
printf("Enter any number of row: ");
/* Here i entered the number of 5 and the output in the screen see below */
scanf("%d",&row);
for(i=1; i<=row; ++i)
{
for(j=1; j<=i; ++j)
{
printf("%d ",j);
}
printf("\n");
}
return 0;
}
Output:
#include <stdio.h>
int main()
{
int i, j, row;
printf("Enter any number of row: ");
/* Here i entered the number of 5 and the output in the screen see below */
scanf("%d",&row);
for(i=1; i<=row; ++i)
{
for(j=1; j<=i; ++j)
{
printf("%d ",j);
}
printf("\n");
}
return 0;
}
Output:

No comments:
Post a Comment