0

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

Edited by Nick Evan: Added code-tags

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by gerard4143
0

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.

0

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

Edited by gerard4143: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.