Chapter 4:
Input And Output
Programming Exercise
Problem # 13:
Write a program to show following output using one cout statement:
1 2 3 4 5
6 7 8 9 10
Solution:
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
cout<<"Output:"<<endl;
cout<<"\t"<<"1"<<"\t"<<"2"<<"\t"<<"3"<<"\t"<<"4"<<"\t"<<"5"<<endl;
cout<<"\t"<<"6"<<"\t"<<"7"<<"\t"<<"8"<<"\t"<<"9"<<"\t"<<"10"<<endl;
return 0;
}
#include<conio.h>
using namespace std;
int main()
{
cout<<"Output:"<<endl;
cout<<"\t"<<"1"<<"\t"<<"2"<<"\t"<<"3"<<"\t"<<"4"<<"\t"<<"5"<<endl;
cout<<"\t"<<"6"<<"\t"<<"7"<<"\t"<<"8"<<"\t"<<"9"<<"\t"<<"10"<<endl;
return 0;
}
Code Screenshot:
Output:
Let me know in the comment section if you have any question.
Previous Post:
12. Program that inputs 3-digit number and displays its digits in speprate three lines.
Comments
Post a Comment