Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Program of Loop (http://www.go4expert.com/forums/program-of-loop-t12930/)

sunveer 14Aug2008 16:05

Program of Loop
 
Q Use for loop to print the following output:



[SIZE=3][COLOR=SandyBrown][FONT=Times New Roman][CENTER]
&
& &
& &
& &
& &
& &
& & & & & & & & & & &

xpi0t0s 14Aug2008 20:14

Re: Program of Loop
 
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.

faizulhaque 14Aug2008 20:29

Re: Program of Loop
 
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:
http://www.imagehostingsite.com/imag...5mnf4ymyy4.jpg


All times are GMT +5.5. The time now is 18:44.