how can i get output like this?
1
2 3
4 5 6
Answers were Sorted based on User's Feedback
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 |
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 |
#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 |
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 |
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 |
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 |
struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
How do I send escape sequences to control a terminal or other device?
Are local variables initialized to zero by default in c?
How do I declare an array of N pointers to functions returning pointers to functions returning pointers to characters?
what is dangling pointer?
What is null pointer in c?
Why c is a mother language?
Can we change the value of constant variable in c?
What is the scope of an external variable in c?
wat s the meaning of (int *)p +4;
write a program to delete an item from a particular location of an linear array?