+ 1

Write a program in c to print column wise.

Enter value:23 Output: 1 11 21 . . 22 . . 23 . . . . . . 10 20

10th Dec 2021, 4:56 AM
Maniya Harshilkumar
1 Resposta
0
#include<iostream> using namespace std; int main(){ int n; cin>>n; int columns,last; last=n%10; if(n%10==0) columns=n/10; else columns=n/10+1; for (int i=1;i<=10;i++){ for (int j=1;j<=columns;j++){ cout<<i+10*(j-1)<<" "; } if(i==last) columns--; cout<<endl; } }
12th Jun 2022, 8:42 AM
Sterling
Sterling - avatar