How to print India by nested loop?
I
IN
IND
INDI
INDIA
Answer Posted / chavidi
void main()
{
char a[20];
int i,j,k;
clrscr();
gets(a);
j=strlen(a);
i=0;
while(i<j)
{
for(k=0;k<=i;k++)
{
printf("%c",a[k]);
}
printf("\n");
i++;
}
}
//APPLICABLE FOR ANY STRING
| Is This Answer Correct ? | 19 Yes | 12 No |
Post New Answer View All Answers
How can I write a function analogous to scanf?
what are the different storage classes in c?
Do pointers store the address of value or the actual value of a variable?
Explain the difference between null pointer and void pointer.
What is meant by keywords in c?
What is keyword with example?
What are the advantages and disadvantages of pointers?
What are loops c?
What is 02d in c?
How can I recover the file name given an open stream?
Tell us something about keyword 'auto'.
What is extern variable in c with example?
What are the features of the c language?
Is c procedural or object oriented?
Is c is a middle level language?