1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Program of Loop

Discussion in 'C' started by sunveer, Aug 14, 2008.

  1. sunveer

    sunveer New Member

    Joined:
    Aug 12, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Q Use for loop to print the following output:




    &
    & &
    & &
    & &
    & &
    & &
    & & & & & & & & & & &​
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     
  3. faizulhaque

    faizulhaque New Member

    Joined:
    May 23, 2008
    Messages:
    213
    Likes Received:
    3
    Trophy Points:
    0
    Occupation:
    Student
    Location:
    Karachi
    Home Page:
    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();
    }
    
    I suppose it couldn;t made without conditions.

    Prof:
    [​IMG]
     

Share This Page