i want code for the follwing series

1
1 2
1 2 3
1 2 3 4
1 2 3 4 ..................n

when we n as 2 it should display
1
1 2

when we gave n as 4 it should dispaly
1
1 2
1 2 3
1 2 3 4

Recommended Answers

All 8 Replies

The code is trivial. Try doing it yourself first before resorting to cheating.

I really unware of the code
please help me out
i m beginer of "C",
if u provide me with cide,i can develop few of that sort
pleae help me

for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
printf("%d",j);
}
printf("\n");
}

Thanks for the reply
i will be using the same
thanks a lot

Thanks for the reply
i will be using the same
thanks a lot

His code isn't correct solution to your problem, but does give you a good start on it.

sorry, made a small mistake, in the inner loop, the condtion must be j<i

I wish I had a banstick right now.

#include<stdio.h>
main()
{
int i,j,n;
printf("Enter the value of n:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
printf("%d ",j);
printf("\n");
}
}

commented: Giving a solution... AND with no code tags. -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.