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

What is the significance of an algorithm to C programming?

590


Is there a way to compare two structure variables?

610


Why do we need functions in c?

551


What is the difference between call by value and call by reference in c?

610


With the help of using classes, write a program to add two numbers.

615






what do you mean by enumeration constant?

594


What do you mean by recursion in c?

621


what is the basis for selection of arrays or pointers as data structure in a program

3782


What is a node in c?

543


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

625


Explain what is the difference between a string and an array?

627


What is a structure and why it is used?

613


What is difference between constant pointer and constant variable?

620


Can you pass an entire structure to functions?

688


What are static variables in c?

623