0
How to print the following pattern?👇
1 A B 2 3 4 C D E F 5 6 7 8 9
4 Respuestas
+ 4
an easy way
cout << line1 << "\n";
cout << line2 << "\n";
you get the point.
Another way you can have mulitple for loops that output acsii for letters and one loop for the numbers.
0
Is not the original pattern
0
I WROTE THIS CODE IN C#
***********************************
using System;
class class1
{
static void Main()
{
int m=1;
char c='A';
Console.WriteLine("Enter No.of Rows::");
int n = int.Parse(Console.ReadLine());
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
if(i%2==0)
{
Console.Write(c+" ");
c++;
}
else
{
Console.Write(m+" ");
m++;
}
}
Console.WriteLine("");
}
}
}