How to print India by nested loop?
I
IN
IND
INDI
INDIA

Answer Posted / ashim ghosh

#include<stdio.h>
#include<conio.h>
void main()
{
char arr[20]={"INDIA"};
int i,j;
for(i=0;i<=5-1;i++)
{
for(j=0;j<=i;j++)
{
printf("%c",arr[j]);
}
printf("\n")
}
getch();
}

Is This Answer Correct ?    18 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

typedef enum { html, java, javascript, perl, cgi } lang;The above statement defines a : a) Union b) User defined type c) Enumerated variable d) none

703


What is identifier in c?

535


Do you know the use of fflush() function?

592


Is null valid for pointers to functions?

601


Compare interpreters and compilers.

633






How can I call fortran?

633


Explain what are binary trees?

602


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

712


What is file in c language?

572


Why we not create function inside function.

1741


Why we use void main in c?

584


How many types of errors are there in c language? Explain

560


What are the advantages of union?

620


What is #define size in c?

638


What is wrong with this program statement? void = 10;

809