+ 1
Write a program in c to print column wise.
Enter value:23 Output: 1 11 21 . . 22 . . 23 . . . . . . 10 20
1 ответ
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;
}
}