I/O Operations Letter Pattern
Jammy is the trainer in Secondary school, he has given the task of printing the letter pattern.
Students has to create a logic which get the integer number which specify the number of rows and according to that students has to print the letter pattern
Programming language need to be used:C++
#include <iostream>
using namespace std;
int main() {
int i,j,n;
char c;
cin>>n;
c='A';
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
cout<<c;
c++;
if(c=='[')
c='A';
}
cout<<endl;
}
return 0;
}
Students has to create a logic which get the integer number which specify the number of rows and according to that students has to print the letter pattern
Programming language need to be used:C++
#include <iostream>
using namespace std;
int main() {
int i,j,n;
char c;
cin>>n;
c='A';
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
cout<<c;
c++;
if(c=='[')
c='A';
}
cout<<endl;
}
return 0;
}
Comments
Post a Comment