- Back to Home »
- asterik , C , code , coding , number , odd , project c++(basic) , right , triangle »
- Coding program to print right triangle through odd number in C through asteriks.
Posted by : Unknown
Monday, 22 December 2014
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
for(int d=1;d<=5;d++){
do {
printf("enter a odd no");
scanf("%d",&a);
}
while(a%2!=1);
int b;
for(b=0;b<a;b++)
{
for(int c=0;c<=b;c++)
printf("*");
printf("\n");
}}
_getch();
}
#include<conio.h>
void main()
{
int a;
for(int d=1;d<=5;d++){
do {
printf("enter a odd no");
scanf("%d",&a);
}
while(a%2!=1);
int b;
for(b=0;b<a;b++)
{
for(int c=0;c<=b;c++)
printf("*");
printf("\n");
}}
_getch();
}