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


Please Help Members By Posting Answers For Below Questions

What should malloc() do?

632


Explain how can you tell whether two strings are the same?

578


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2296


How can I recover the file name given an open stream or file descriptor?

586


What are shell structures used for?

591






What does c mean in standard form?

589


Which is better between malloc and calloc?

658


What is the difference between class and object in c?

571


Explain the advantages and disadvantages of macros.

612


What do you know about the use of bit field?

600


What is wild pointer in c with example?

568


Why we not create function inside function.

1740


What are the two types of functions in c?

553


How to write c functions that modify head pointer of a linked list?

534


What are the rules for identifiers in c?

579