write a program to print your school name four times
Answers
Answered by
0
WAP to display your school name four times.
Output:
Enter your school name: APS cantt
APS cantt
APS cantt
APS cantt
APS cantt
Explanation:
Following are the program in the C++ Programming Language.
//set header file
#include <iostream>
//set namespace
using namespace std;
//define main method
int main()
{ //set string type variable
string name;
//print message and get input from the user
cout<<"Enter your school name: ";
getline (cin, name);
cout<<endl;
//set for loop to print name four times
for(int i=0;i<4;i++)
{
cout<<name<<endl;
}
}
Following are the description of the program:
- Set required header file and namespace then, define the main method and inside it.
- Set string data type variable 'name', in which we get string input from the user with a message.
- Set the for loop which iterates from 0 and end at 3 that is 4 times, then print the variable 'name'.
Learn More:
WAP in Java to print your school name four times : brainly.in/question/7357278
Similar questions