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 does c mean before a date?
Why can arithmetic operations not be performed on void pointers?
How pointer is different from array?
What is double pointer in c?
Explain what are the __date__ and __time__ preprocessor commands?
What is cohesion in c?
How can I pad a string to a known length?
What is variable and explain rules to declare variable in c?
Explain how do you determine the length of a string value that was stored in a variable?
Who developed c language and when?
Is sizeof a keyword in c?
What are the types of c language?
What is the difference between far and near ?
What is the value of h?
Explain how are portions of a program disabled in demo versions?