13. Program to show following output using one cout statement.

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;
}

Code Screenshot:

Chapter 4, Coding tutorial, Computer Science, CPP Basics, Exercise Solution, Input and Output, IT Series, Object Oriented Programming using C++, Programming for beginners, Programming Tutorial

Output:

Chapter 4, Coding tutorial, Computer Science, CPP Basics, Exercise Solution, Input and Output, IT Series, Object Oriented Programming using C++, Programming for beginners, Programming Tutorial


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