Follow by Email

शनिवार, 2 फ़रवरी 2019

how to print triangle using loop in c language

how to print triangle using loop in c language

iss question mai humko n hight aur n width ka ek right angle print krna hai
isske liye code niche lika gya hai iss code ko dhyan se smjne ki kosis kriye 
#include <stdio.h>
int again(int ); /function declaration
int main()
{
int i=0,n,k; /yaha n height aur width k k liye use kiya gya hai
scanf("%d",&n); /triangle ki height aur width
k=n; / k mai n ki value assign kri gyi hai
for(i=0;i<=k;i++)
{
n=again(n);/humne ek again naam ka function bnaya hai
}


return 0;
}

int again(int n)/function definition
{
int i=0;
for(i=0;i<=n;i++)
{
printf("*");
}
printf("\n");
n--;
return n;
c tutorial }
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
NEXT ARTICLE Next Post
PREVIOUS ARTICLE Previous Post
 

best and cheap hosting

Delivered by FeedBurner