Problem :- 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
Solution :-
#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;
}
Logic :- Enter your MSG and Run any loop ,this is your choice how many time's you want to print a MSG
Solution :-
#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:-
0 Comments: