Home Uncategorized Half Pyramid Triangle Pattren in C

Half Pyramid Triangle Pattren in C

SHARE


Here we written code for print given triangle pattern with output.

For improvement of your coding skills we give some tasks along with it. If you solve this tasks and send to our email (onlineexamshubteam@gmail.com) with your details. we will display your details(like Name, City, college, photo) in our site.

Task : Write a c program to print n lines of following triangle. Following pattern contains 3 lines.
*

***

*****

Write a C Program to print triangle pattern.

*
**
***
****
*****

#include
int main()
{
int i,j,n;
printf(“Enter no.of lines you want : “);
scanf(“%d”,&n);
for(i=0;i < n;i++)
{
for(j=0;j<=i;j++)
{
printf(“* “);
}
printf(“\n”);
}
}

Output:
Enter number of lines you want : 6
*
* *
* * *
* * * *
* * * * *
* * * * * *
Back to the programs.

SHARE
Previous articleFunctions in C
Next articleSample c program
Regards Ekvij Team https://ekvij.com/