How to print India by nested loop?
I
IN
IND
INDI
INDIA
Answer Posted / ramesh k
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char name[20];
int a;
clrscr();
printf("enter the INDIA name");
scanf("%c",&name);
a=strlen(name);
for(int i=0;i<=a;i++)
{
for(int j=0;j<=i;j++)
{
printf("%c",name[i]);
}
printf("\n");
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 12 No |
Post New Answer View All Answers
When should a far pointer be used?
What is calloc malloc realloc in c?
What are the types of unary operators?
What is assignment operator?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
can we implement multi-threads in c.
What are variables c?
What does void main return?
What is a example of a variable?
Difference between pass by reference and pass by value?
What is indirection?
How many bytes is a struct in c?
Why do we need a structure?
Describe the header file and its usage in c programming?
What is function prototype in c with example?