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

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.

3132


Who invented b language?

924


What is nested structure?

580


Process by which one bit pattern in to another by bit wise operation is?

617


What are disadvantages of C language.

652






Suppose we have a table name EMP as below. We want to perform a operation in which, I want to change name ‘SMITH’ from as ‘SMITH JAIN’. Also I want to change the name of the column from ENAME to E_NAME. EMPNO ENAME JOB MGR HIREDATE SAL 7369 SMITH Coder 7902 17-DEC-80 800 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 7521 WARD SALESMAN 7698 22-FEB-81 1250

1514


Write a code of a general series where the next element is the sum of last k terms.

598


Give basis knowledge of web designing ...

1582


What are the parts of c program?

642


What is difference between && and & in c?

604


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1126


In a byte, what is the maximum decimal number that you can accommodate?

630


What is a scope resolution operator in c?

756


How do I use strcmp?

647


Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

693