how can i get output like this?
1
2 3
4 5 6

Answers were Sorted based on User's Feedback



how can i get output like this? 1 2 3 4 5 6..

Answer / nayan soni

#include <stdio.h>
#include <conio.h>

void main()
{
int count = 1;
for(int i = 1;i <= 3;i++)
{
for(int j = 1;j <= i;j++)
{
printf("%d ", count);
count++;
}
printf("\n");
}

getch();
}

It works perfectly.. Tested by running the program..

Is This Answer Correct ?    4 Yes 0 No

how can i get output like this? 1 2 3 4 5 6..

Answer / arun asokan

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

Is This Answer Correct ?    2 Yes 0 No

how can i get output like this? 1 2 3 4 5 6..

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf("enter the terms :");
scanf("%d",&n);
count=1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=(i);j++)
printf("%d ",count++);
printf("\n");
}
getch();
}


thank u

Is This Answer Correct ?    2 Yes 1 No

how can i get output like this? 1 2 3 4 5 6..

Answer / sarvesh

#include<stdio.h>
#include<conio.h>
main()
{
int i,n,j;
int m=1;
clrscr();
printf("enter number");
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
printf("%d",m++);
}
printf("\n");
}getch();
}

Is This Answer Correct ?    0 Yes 1 No

how can i get output like this? 1 2 3 4 5 6..

Answer / manojkumar challagundla

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

Is This Answer Correct ?    2 Yes 4 No

how can i get output like this? 1 2 3 4 5 6..

Answer / karthickumar

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

Is This Answer Correct ?    3 Yes 6 No

Post New Answer

More C Interview Questions

In header files whether functions are declared or defined?

1 Answers   TCS,


1 1 1 1 2 1 1 3 3 1 1 4 6 4 1

1 Answers  


write a program in c to print **** * * * * ****

1 Answers   TCS,


What is a ternary operator in c?

0 Answers  


1 232 34543 4567654 can anyone tell me how to slove this c question

6 Answers  






What are the advantages and disadvantages of pointers?

0 Answers  


write a C code To reverse a linked list

2 Answers   Motorola, Wipro,


Compare and contrast compilers from interpreters.

0 Answers  


write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language

18 Answers   IT Park, TCS,


plssssss help !!....using array.. turbo c.. create a program that will accept number of words to be consored. .a word must not exceed 10 characters long .the text to be entered will be no longer than 200 characters .there will be no 10 words example: enter number of words to be censor: 5 enter words to censor: windows office microsoft bill gates enter text to censor: bill gates founded microsoft and makes office and windows sample output: <consored> <censored> founded <censored> and makes <censored> and <censored>

1 Answers  


Is file a keyword in c?

0 Answers  


Explain what is the difference between far and near ?

0 Answers  


Categories