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 | 12 No |
Post New Answer View All Answers
What is the function of this pointer?
What does malloc () calloc () realloc () free () do?
What is the use of structure padding in c?
can any one please explain, how can i access hard disk(physical address)? it is possible by the use of far,near or huge pointer? if yes then please explain......
What is the difference between formatted&unformatted i/o functions?
which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;
What is a buffer in c?
What is header file definition?
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
Can a variable be both constant and volatile?
What is integer constants?
How would you rename a function in C?
What is the scope of static variable in c?
When c language was developed?
What is use of integral promotions in c?