How We Can Solve This In C Program
1
1 2
1 2 3
Answers
Answered by
2
C program to find
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
include<stdio.h>
int main(){
int i, j, n;
printf("Enter the number of lines required: ");
scanf("%d", &n);
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
printf("%d\t", j);
}
printf("\n");
}
return 0;
}
Sample Input
Enter the number of lines required: 5
Sample Output
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
include<stdio.h>
int main(){
int i, j, n;
printf("Enter the number of lines required: ");
scanf("%d", &n);
for(i=1;i<=n;i++){
for(j=1;j<=i;j++){
printf("%d\t", j);
}
printf("\n");
}
return 0;
}
Sample Input
Enter the number of lines required: 5
Sample Output
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
surajgusain603pe72io:
in Int I,j,n So how t is come in later print f (%d/t) Something This Plz Tell Me How I Don't Understand
Answered by
1
All you nee to do is to know about loops . The type of loop used here will be for loop . The main coding that will come under main is you need to make to loop and nest them . Here it is.
Attachments:
Similar questions