Q:

C++ Program To Print A Message Multiple Times

belongs to collection: Loop Programs In C ++Programming

0

Write A Program To Print A Message Multiple Times

Logic :-

Enter your MSG and Run any loop ,this is your choice how many time's you want to print a MSG 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<iostream>
using namespace std;
int main()
{
  int n,i;
  string str;
  
 cout<<"Enter The MSG :\n";
 cin>>str;
  
 cout<<"Enter How Many Times You Want To Print MSG : \n";
 cin>>n;
  
 for(i=0 ;i<n ;i++)
 {
   cout<<str<<endl;
 } 
 cout<<endl;
 return 0;

}

 

Output:

Enter The MSG :

mohamad

Enter How Many Times You Want To Print MSG : 

8

mohamad

mohamad

mohamad

mohamad

mohamad

mohamad

mohamad

mohamad

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Program To Print A Table Using For Loop... >>
<< C++ Program To Find Factorial...