Pattern 15
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++)
{
for(j=0;j<=i;j++)
{
printf("%c",m);
m++;
if(m>90)
{
m=64;
}
}
printf("\n");
}
getch();
}
O/P:
write a prog. to print following pattern
A
BC
DEF
GHIJ
KLMNO#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++)
{
for(j=0;j<=i;j++)
{
printf("%c",m);
m++;
if(m>90)
{
m=64;
}
}
printf("\n");
}
getch();
}
O/P:
No comments:
Post a Comment