Tell me a C program to display the following Output?
1 1 1 1 1
2 2 2 2
3 3 3
4 4
5

Answers were Sorted based on User's Feedback



Tell me a C program to display the following Output? 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5..

Answer / deepti

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

Is This Answer Correct ?    9 Yes 1 No

Tell me a C program to display the following Output? 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5..

Answer / devi

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

Is This Answer Correct ?    1 Yes 0 No

Tell me a C program to display the following Output? 1 1 1 1 1 2 2 2 2 3 3 3 4 4 5..

Answer / sreesen@ymail.com

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

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More C Interview Questions

What is getche() function?

0 Answers  


Why is c called c not d or e?

0 Answers  


How to calculate sum

2 Answers  


What are the loops in c?

0 Answers  


Why do u use # before include in a C Progam?

9 Answers   IBM,






code for selection sort?

1 Answers  


Explain how do you search data in a data file using random access method?

0 Answers  


Can i use Two or More Main Funtion in any C program.?

4 Answers  


What should malloc(0) do?

0 Answers  


Explain what standard functions are available to manipulate strings?

0 Answers  


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

0 Answers  


Differentiate between a for loop and a while loop? What are it uses?

0 Answers   TISL,


Categories