C Program to Print Right Angled Triangle

C Program to print Right Angled Triangle using For Loop

1.
@
@@
@@@
@@@@
@@@@@   
#include
int main(){
        int x,i,j;
        printf(“Triangle range:”);
        scanf(“%d”,&x);
        for(i=1;i<=x;i++){
                for(j=1;j<=i;j++)
                        printf(“@”);
                printf(“\n”);
        }
        return 0;
}
2.
@@@@@
@@@@
@@@
@@
@
#include
int main(){
            int x,i,j;
        printf(“Triangle Range:”);
        scanf(“%d”,&x);
        for(i=1;i<=x;i++){
                for(j=i;j<=x;j++)
                        printf(“@”);
                printf(“\n”);
        }
        return 0;
}
3. 
              @
           @@
       @@@
   @@@@
@@@@@
#include
int main(){
        int x,i,j,k;
        printf(“Triangle Range:”);
        scanf(“%d”,&x);
        for(i=1;i<=x;i++)
        {
                for(j=x-1;j>=i;j–)
                        printf(” “);
                for(k=1;k<=i;k++)
                        printf(“@”);
                printf(“\n”);
        }
        return 0;
}
4.
@@@@@
   @@@@
      @@@
         @@
            @
#include
int main()
{
        int i,j,k,x;
        printf(“Triangle Range:”);
        scanf(“%d”,&x);
        for(i=1;i<=x;i++)
        {
                for(j=x;j>=i;j–)
                        printf(“@”);
                printf(“\n”);
                for(k=1;k<=i;k++)
                        printf(” “);
        }
}
About mohan

This is Mohan Jayapalan author of TechPages Blog.I am a part time blogger and Currently working for private Software Concern.

© Copyright 2010-2016 www.techpages.org · All Rights Reserved · Powered by WordPress ·