Techigai GCET
Question #1
C
Print the below pattern
Sample input: 5
Sample output
1 2 3 4 5
10 9 8 7 6
11 12 13 14 15
20 19 18 17 16
21 22 23 24 25
Input format
Answers
Answered by
0
Answer:
hiiiiiiiiiiiiiiiioiiiii twister ay jaldi
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("\n");
}
return 0;
}
Explanation:
Similar questions