Pattern 23
write a prog. to print following pattern
#include<conio.h>
#include<stdio.h>
void main()
{
int n=0,m=66,i,j;
clrscr();
printf("Enter N:");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
m=66;
for(j=0;j<=i;j++,m+=2)
{
printf("%c",m);
if(m>=90)
{
m=64;
}
}
printf("\n");
}
getch();
}
O/P:
write a prog. to print following pattern
B
BD
BDF
BDFH
BDFHJ
#include<conio.h>
#include<stdio.h>
void main()
{
int n=0,m=66,i,j;
clrscr();
printf("Enter N:");
scanf("%d",&n);
printf("\n\n");
for(i=0;i<n;i++)
{
m=66;
for(j=0;j<=i;j++,m+=2)
{
printf("%c",m);
if(m>=90)
{
m=64;
}
}
printf("\n");
}
getch();
}
O/P:
No comments:
Post a Comment