Write a C program to input ten numbers and print the same
Answers
Answered by
1
Answer:
How do I write a C program to read 10 integers and display these numbers by printing three numbers in a line separated by commas?
I'll write a super short one:
(Does exactly what you want, no more no less)
#include <bits/stdc++.h>
int main{
int x;
for(int I=0;I<10;I++){
cin>>x;
cout<<x;
if(I==9)
break; // we don't need anything after the 10th number so we exit
if(I%3==2)
cout<<endl;
else
cout<<",";
}
return 0;
}
Explanation:
mark me as brilliant
Similar questions