ABCD
ABC
AB
A
Code ::
#include <stdio.h>
int main ()
{
int i,j,l;
char ch,c;
printf("Enter a letter (capital letter): ");
ch=getchar();
l=ch-'A';
for(i=l;i>=0;i--)
{
c='A';
for(j=0;j<=i;j++)
{
printf("%c",c++);
}
printf("\n");
}
return 0;
}
WAP to input the name and age of a person and print the name as many times as age?
ReplyDelete#include
Delete#include
void main ()
{
char name[100];
int age,i;
printf("Enter your name: ");
gets(name);
printf("Enter your age: ");
scanf("%d",&age);
for(i=1;i<=age;i++)
{
printf("%d. ",i);
puts(name);
}
}
stdio.h
Deletestring.h