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
What should malloc() do?
Explain how can you tell whether two strings are the same?
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
How can I recover the file name given an open stream or file descriptor?
What are shell structures used for?
What does c mean in standard form?
Which is better between malloc and calloc?
What is the difference between class and object in c?
Explain the advantages and disadvantages of macros.
What do you know about the use of bit field?
What is wild pointer in c with example?
Why we not create function inside function.
What are the two types of functions in c?
How to write c functions that modify head pointer of a linked list?
What are the rules for identifiers in c?