Showing posts with label Write C Program to Print a Triangle. Show all posts
Showing posts with label Write C Program to Print a Triangle. Show all posts

Write C Program to Print a Triangle

#include<stdio.h>

#include<conio.h>

void main()

{

int n;

printf("enter the lines :");

scanf("%d",&n);

for(int i=1;i<=n/2;i++)

{

printf("*\n");

for(int j=1;j<=2*i;j++)

printf("%d",j);

printf("\n");

}

if(n%2!=0)

printf("\n*");

getch();

}

Labels