How to print India by nested loop?
I
IN
IND
INDI
INDIA
Answer Posted / ramesh k
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char name[20];
int a;
clrscr();
printf("enter the INDIA name");
scanf("%c",&name);
a=strlen(name);
for(int i=0;i<=a;i++)
{
for(int j=0;j<=i;j++)
{
printf("%c",name[i]);
}
printf("\n");
}
getch();
}
| Is This Answer Correct ? | 1 Yes | 12 No |
Post New Answer View All Answers
What are actual arguments?
Explain two-dimensional array.
Define Spanning-Tree Protocol (STP)
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
What are the types of i/o functions?
a program that can input number of records and can view it again the record
Draw a diagram showing how the operating system relates to users, application programs, and the computer hardware ?
What is an lvalue in c?
What are loops in c?
How arrays can be passed to a user defined function
a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion
the factorial of non-negative integer n is written n! and is defined as follows: n!=n*(n-1)*(n-2)........1(for values of n greater than or equal to 1 and n!=1(for n=0) Perform the following 1.write a c program that reads a non-negative integer and computes and prints its factorial. 2. write a C program that estimates the value of the mathematical constant e by using the formula: e=1+1/!+1/2!+1/3!+.... 3. write a c program the computes the value ex by using the formula ex=1+x/1!+xsquare/2!+xcube/3!+....
Explain what standard functions are available to manipulate strings?
What happens if header file is included twice?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year