write a program to print the pattern
Answers
Answered by
3
#include
<iostream.h>
#include
<conio.h>
void main()
{
clrscr();
int i, j; f
or(i=0; i<5; i++)
{
for(j=0; j<=i; j++)
{
cout<<"* "; } cout<<"\n"; } getch();
}
<iostream.h>
#include
<conio.h>
void main()
{
clrscr();
int i, j; f
or(i=0; i<5; i++)
{
for(j=0; j<=i; j++)
{
cout<<"* "; } cout<<"\n"; } getch();
}
Answered by
1
Answer:
class Pattern
{
public static void main()
{
for(int i=4;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
if(j%2==0)
System.out.print(i+" ");
else
System.out.print((i+1)+" ");
}
System.out.println();
}
for(int i=5,k=69;i>=0;i--,k--)
{
for(int j=1;j<=i;j++)
System.out.print((char)k+" ");
System.out.println();
}
}
}
Similar questions