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 convert a string to a number?
Do you have any idea about the use of "auto" keyword?
How can type-insensitive macros be created?
why we wont use '&' sing in aceesing the string using scanf
Differentiate between ordinary variable and pointer in c.
What is main return c?
How many parameters should a function have?
Explain what is the stack?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Explain union.
Is a house a shell structure?
What are header files and what are its uses in C programming?
main() { printf("hello"); fork(); }
How do you construct an increment statement or decrement statement in C?
What are the application of c?