Program of Loop

sunveer's Avatar, Join Date: Aug 2008
Light Poster
Q Use for loop to print the following output:



[SIZE=3][COLOR=SandyBrown][FONT=Times New Roman][CENTER]
&
& &
& &
& &
& &
& &
& & & & & & & & & & &
0
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
How far have you got and where are you stuck?
We won't write the code for you, unless you're willing to pay the going rate.
0
faizulhaque's Avatar, Join Date: May 2008
Skilled contributor
Codings:
Code:
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
for (int a=0;a<8;a++)
{
	if (a==0)
	{
	for (int b=0;b<1;b++)
	printf("&\n");
	}
	else if (a>0 && a<7)
	{
	for (int c=0;c<1;c++)
	printf("& &\n");
	}
	else if (a==7)
	{
	for(int d=0;d<11;d++)
	printf("& ");
	}
}
getch();
}
[b]I suppose it couldn;t made without conditions.

Prof: