ACE Engineering College

This Community is for all members of IT Branch studying in ACE Engineering College
 
HomeHome  CalendarCalendar  FAQFAQ  SearchSearch  MemberlistMemberlist  UsergroupsUsergroups  RegisterRegister  Log inLog in  

Share | 
 

 Displaying Triangles with *'s or 1's using Loops

View previous topic View next topic Go down 
AuthorMessage
Dartz
Admin


Number of posts: 18
Age: 22
Registration date: 2008-11-15

PostSubject: Displaying Triangles with *'s or 1's using Loops   Mon Dec 29, 2008 12:42 pm

Code:
#include<stdio.h>
#include<conio.h>

void main()
{
    int n,i,j,k;
    clrscr();
    printf("Enter the Number of Lines: ");
    scanf("%d",&n);

    for(i=1;i<=n;i++)
    {
        printf("\n\n");

        for(j=n;j>=i;j--)
        {
            printf("\t");
        }

        for(k=1;k<=i;k++)
        {
            printf("*\t\t");
        }
    }

    getch();
}


Output:

n=4


*
* *
* * *
* * * *

I'll put up the Screenshot later. I've been Busy for the past few weeks >_> and will update most of the programs in a week or two from today.



~ Dartz

_________________
~Administrator~

If you join my side, you have nothing to fear... If not, then farewell!

Back to top Go down
View user profile http://aceit.heavenforum.com
 

Displaying Triangles with *'s or 1's using Loops

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» tented arch like loops
» Black Triangles
» loop in moon mount
» Pine tree dream
» life purpose/finger prints

Permissions in this forum:You cannot reply to topics in this forum
ACE Engineering College :: First Year B.Tech :: C and Data Structures :: All Programs-