Wednesday, 29 October 2014

Draw triangle shape in C code in which user enter its desire size of triangle. Using nested for loop and asterisk

Leave a Comment
Code:
#include<stdio.h>
using namespace std;
int main()
{
    int numb=0;
    printf("Enter the size of triangle = ");
    scanf("%d",&numb);
    for(int i=0;i<numb;i++)
    {
        for(int b=numb;b>i;b--)
        {
            printf("*");
        }
        printf("\n");
    }
    return 0;
}






Output




If You Enjoyed This, Take 5 Seconds To Share It