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

Answers were Sorted based on User's Feedback



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

Answer / dhruv sharma rkdf

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

Is This Answer Correct ?    3 Yes 0 No

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

Answer / ep

#include <stdio.h>

int main()
{

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

return 0;
}

Is This Answer Correct ?    1 Yes 0 No

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

Answer / jayaraj.s

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

Is This Answer Correct ?    0 Yes 0 No

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

Answer / dhruv sharma rkdf

hello Jayaraj.s..........
your program will give the following compilation error:
"getch should have a prototype"

you need to include "conio.h" header file...

Is This Answer Correct ?    0 Yes 0 No

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

Answer / atul shukla

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

Is This Answer Correct ?    0 Yes 0 No

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

Answer / letskools

I think th correct program is this for the above output
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();

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

Is This Answer Correct ?    2 Yes 3 No

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

Answer / rajarshi bhadra

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
clrscr();

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

Is This Answer Correct ?    4 Yes 7 No

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

Answer / subasaranya

1 2 3 4 5
2 3 4 5
3 4 5
4 5
5

Is This Answer Correct ?    2 Yes 7 No

Post New Answer

More C Interview Questions

What is the description for syntax errors?

0 Answers  


There is a number and when the last digit is moved to its first position the resultant number will be 50% higher than the original number.Find the number?

1 Answers  


what is a pointer

4 Answers   Bank Of America, TCS,


write a program to copy a string without using a string?

2 Answers  


Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors

3 Answers  






What is the function of this pointer?

0 Answers   Agilent, ZS Associates,


#include<stdio.h> main() { int i=5; printf("%d",i*i-- - --i*i*i++ + ++i); } tell the answer with correct reason .specially reason is important nt answer ans by turbo c is -39

1 Answers   GameLoft,


Magic square

0 Answers  


what is the flow of execution in cprogram? ex:printf();,scanf();

2 Answers  


In which language linux is written?

0 Answers  


When the macros gets expanded?

0 Answers  


Why we use conio h in c?

0 Answers  


Categories