program for following output using for loop?
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5

Answer Posted / devi

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",i);
}
printf("\n");
}
getch();
}

Is This Answer Correct ?    19 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is output redirection?

683


Disadvantages of C language.

649


Explain what is the benefit of using enum to declare a constant?

581


What is the difference between union and structure in c?

567


What is external variable in c?

605






Why we not create function inside function.

1742


Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings

2243


What is the purpose of realloc()?

663


What is pointers in c?

642


Explain the bubble sort algorithm.

636


Is c easy to learn?

552


Explain what is the difference between text files and binary files?

609


What is the difference between Printf(..) and sprint(...) ?

778


diff between exptected result and requirement?

1592


What is formal argument?

642