C++ Program To Print A Message Multiple Times Using Loop

#include<iostream>
using namespace std;
int main()
{
  int n,i;
  string str;
 cout<<"Enter the message u want to print :\n";
 cin>>str;
 cout<<"Enter the number of time you want to print the message \n";
 cin>>n;
 for(i=0 ;i<n ;i++)
 {
   cout<<str<<endl;
 }
 cout<<endl;
 return 0;
}

OUTPUT:

Enter the message u want to print
chase
Enter the number of time you want to print the message
4
chase
chase
chase
chase

Leave a Comment