/*Write a C program to print
3 numbers in a line, starting
from 1 and print n lines.
Accept number of lines (n,
integer) from the user.
Test Data :
Input number of lines: 5
Expected Output:
1 2 3
4 5 6
7 8 9
10 11 12
13 14 15
*/
#include <stdio.h>
int main()
{
int i,num,x=1,j;
printf("Input number of \
line: ");
scanf("%d",&num);
for(i=1;i<=num;i++)
{
for(j=0;j<3;j++)
{
printf("%d \t",x++);
}
j=0;
printf("\n");
}
return 0;
}
No comments:
Post a Comment