Write a program IN C to print the following pattern based on the input n. sample input : 5
sample output:
2
3 4
4 5 6
5 6 7 8
6 7 8 9 10
Answers
Answered by
0
Answer:
for(int i=1;i<n;i++)
for(int j=i+1;j<n;j++)
printf(j);
printf(/n);
Answered by
1
int main(){
int n; // number of rows to be print
int initial_value=2;
int i, j; // loop initializer
int value=2;
printf("Enter input n : ");
scanf("%d", &n); //Accepting row numbers in variable n
for(i=1; i<=n; ++i){
value = i+1;
for(j=1; j<=i ; ++j){
printf("%d ", value++);
}
printf("\n");
}
return 0;
}
Similar questions