i have just started c language and i have only study "while" and "for" "if else"

please help me in this question using loops(without usuing arrays)


write a program that prodeuce the following output:


0
0 1
0 1 2
0 1 2 3
0 1 2 3 4
0 1 2 3 4 5

#include<stdio.h>
void main(void)
{

int inner;
for(int outer=1;outer<=6;outer++)

{
inner=1;
while(inner<=outer)
{
printf("0");

___________
please help me in this code

Recommended Answers

All 2 Replies

Well you could post something which at least compiles.

I mean, you seem to be on the right track, it's like you just gave up because you couldn't make it work on the first edit.

i have just started c language and i have only study "while" and "for" "if else"

please help me in this question using loops(without usuing arrays)


write a program that prodeuce the following output:


0
0 1
0 1 2
0 1 2 3
0 1 2 3 4
0 1 2 3 4 5

#include<stdio.h>
void main(void)
{

int inner;
for(int outer=1;outer<=6;outer++)

{
inner=1;
while(inner<=outer)
{
printf("0");

___________
please help me in this code

What I see from the posted code is...well you need to review the basic structure of a C program...See below

#include <stdio.h>

int main(void)
{
	int inner, outer;

	for (outer = 0; outer <= 6; ++outer)
	{
		for(inner = 0; inner <= outer; ++inner)
		{
			/*do some thing*/
		}
		/*do some thing*/
	}
	return 0;
}

Also - check the tutorial on code tags

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.