write a program in c to print the pattern where sample input is 5 and sample output is12345 109876 1112131415 2019181716 2122232425
Answers
Answered by
0
Answer:
hiiiiiiiiiiiiL uttarpradesh
Answered by
1
Answer:
#include <stdio.h>
int main(){
int n;
scanf("%d", &n);
int i, j, k = 1;
for (i = 0; i < n; i++){
if (i&1){
k += 1;
for (j = 0; j < n; j++){
k--;
printf("%d", k);
}
}
else{
k -= 1;
for (j = 0; j < n; j++){
k++;
printf("%d", k);
}
}
k += n;
printf(" ");
}
return 0;
}
Explanation:
Similar questions