Twitter Update

The program makes an equilateral triangle [C]

This program will input the first t of the triangle. and will form an equilateral triangle, you can change into into numbers, or the pascal triangle. or the other . This is the code :


#include<stdio.h>
#include<conio.h>
void main()
{
    int tinggi;
    int a=0,b,k;
    printf("            ==Program untuk membuat segitiga sama sisi==");
    printf("\n\nInput T triangle : ");
    scanf("%i",&tinggi);
    printf("\n");
    b=tinggi;
    for(int i=0;i<tinggi;i++)
    {
      
        for(k=0;k<=b;k++)
        {
            printf("%c",32);
        }
        b--;
        for(int j=0;j<a+1;j++)
        {  
            printf("*");
        }
        printf("\n");  
        a=a+2;
      
    }
        getch();
  
}

Hopefully can help :)

0 comments:

Post a Comment

ABOUT ME

IP
Albert Julius. Powered by Blogger.
Copyright © Albert'Blog