C++ Program for Printing Same Character Again and Again

Program Code:

#include<iostream>
using namespace std;
int main()
{
int x;
char y;
cout<<"Enter any character :  ";
cin>>y;
cout<<"Enter integer value :  ";
cin>>x;
for(int i=0;i<x;i++)
{
cout<<"\n"<<y;
}
return 0;
}

Output:

.exe file

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.