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

Answers were Sorted based on User's Feedback



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

Answer / natu

Hellow Sashi Ur wrong because Ur program is giving output as
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

but the expected output is
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
please refer and tell me

Is This Answer Correct ?    49 Yes 0 No

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

Answer / lohith

#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 ?    43 Yes 9 No

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

Answer / 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

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

Answer / jayaraj.s

#include <stdio.h>
main()
{
int a,b;
for(a=1;a<=5;a++)
{
printf("\n%d",a);
for(b=1;b!=a;b++)
{
printf("%d",a);
}
}
getch();
}

Is This Answer Correct ?    8 Yes 2 No

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

Answer / sampath

for(i=1;i<=5;i++){
for(j=i;j<=i;j++)
printf("%d",i);
printf("\n");
}

Is This Answer Correct ?    6 Yes 1 No

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

Answer / pra japati apurv d

#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 ?    4 Yes 0 No

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

Answer / aky

#include<iostream.h>
#include<conio.h>
void main()
{
for(int i=1;i<=10;i++)
{
for(int j=1;j<=i;j++)
{
cout<<j;
}
cout<<endl;
}
}

Is This Answer Correct ?    4 Yes 3 No

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

Answer / shashi kumar c.a

#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",j);
}
}
getch();
}

Is This Answer Correct ?    13 Yes 20 No

Post New Answer

More C Interview Questions

Explain how can a program be made to print the line number where an error occurs?

0 Answers  


Why static variable is used in c?

0 Answers  


the maximum width of a c variable name can be a) 6 characters b) 8 characters c) 10 characters d) 20 characters

2 Answers  


Main must be written as a.the first function in the program b.Second function in the program c.Last function in the program d.any where in the program

19 Answers   CTS, HCL, TCS,


is it possible to create your own header files?

0 Answers  






When you call malloc() to allocate memory for a local pointer, do you have to explicitly free() it?

2 Answers   Aloha Technology,


Is fortran still used today?

0 Answers  


what r callback function?

1 Answers  


Does c have an equivalent to pascals with statement?

0 Answers  


Explain the ternary tree?

0 Answers  


What are the three constants used in c?

0 Answers  


What is keyword with example?

0 Answers  


Categories