Pattern 22
write a prog. to print following pattern
#include<conio.h>
#include<stdio.h>
void main()
{
int n=0,m=65,i,j;
clrscr();
printf("Enter N:");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
m=65;
for(j=0;j<=i;j++,m+=2)
{
printf("%c",m);
if(m>88)
{
m=63;
}
}
printf("\n");
}
getch();
}
O/P:
write a prog. to print following pattern
A
AC
ACE
ACEG
ACEGI
#include<conio.h>
#include<stdio.h>
void main()
{
int n=0,m=65,i,j;
clrscr();
printf("Enter N:");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
m=65;
for(j=0;j<=i;j++,m+=2)
{
printf("%c",m);
if(m>88)
{
m=63;
}
}
printf("\n");
}
getch();
}
O/P:
No comments:
Post a Comment