Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

plzz solve this

+1 vote
asked Oct 2, 2018 by kandhala vishwaksena (130 points)

         *
        **
       ***
      ****
     *****
    ******
   *******
  ********
 *********
**********
need to print a triangle like this

10 Answers

0 votes
answered Oct 2, 2018 by anonymous
#include <stdio.h>

void main()
{
 int i,k,j;
 for(i=10;i>0;i--)
 {
     for(k=i;k>0;k--)
     {
     printf(" ");
 }
 
 for(j=10;j>i;j--)
 {
     printf("*");
 }
 printf("\n");

}
}
0 votes
answered Oct 2, 2018 by anonymous
#include <stdio.h>

int main()
{
   int i,j;
   for(i=0; i<=10; i++){
       for(j=0; j<i; j++){
       printf("*");
       }
       printf("\n");
   }
}
–1 vote
answered Oct 2, 2018 by Koli (120 points)
#include int main() { int m,n; for(m=0; m<11; m++){ for(n=0; n<m; n++){ printf("*"); } printf("\n"); } }
+2 votes
answered Oct 8, 2018 by Dinesh Koppula
#include<iostream>
using namespace std;
 int main()
 {
     for (int i=10; i>=0; i--)
     {
         for(int j=0; j<=10; j++)
         {
             if (j>=i)
             cout<<"*";
             else
             cout<<" ";
         }
         cout<<"\n";
     }
    return 0;
 }
0 votes
answered Oct 8, 2018 by anonymous
#include <stdio.h>

int main()
{
    int i,j,k;
    for(i=1;i<=10;i++)
    {
        for(j=i;j<10;j++)
        {
            printf(" ");
        }
        for(k=1;k<=i;k++)
        {
            printf("*");
        }
        printf("\n");
    }
    return 0;
}
0 votes
answered Oct 9, 2018 by Bhavya
#include<stdio.h>

int main()

{

int i,j,n;

printf("enter no of rows");

scanf("%d",&n);

for(i=0;i<n;i++)

{

for(j=0;j<n;j++)

{

if(i+j>=9)

{

printf("*");

}

else

{

printf(" ");

}

}

printf("\n");

}

}
0 votes
answered Oct 9, 2018 by Fady Serhan (420 points)

simple C Code: 

#include <stdio.h>

void printStar(int n); //helper function

int main()
{
    int NUM;
    
    printf("Enter num of lines: ");
    scanf("%d",&NUM);
    
    for(int i =0 ; i<=NUM;i++)
    {
        printStar(i);
        printf("\n");
    }

    return 0;
}

void printStar(int n)
{
    for(int i=0;i<n;i++)
    printf("*");
}

0 votes
answered Oct 10, 2018 by anonymous
Nice, how everybody is doing his/her homework. You didn't helped him/her at all
0 votes
answered Oct 10, 2018 by Charansai Myana (150 points)
#include <stdio.h>

int main()
{
    int i,j;
  
    for(i=0;i<=9;i++)
    {
        for(j=0;j<=9;j++)
        {
           if(i<9-j)
           
           {
               printf(" ");
           }
           
            else
                printf("*");
            
        }
        printf("\n");
    }

    return 0;
}
0 votes
answered Oct 10, 2018 by anonymous
#include stdio.h>

int main()

{

int r,n,s,c;

printf("enter no.of rows:");

scanf("%d",&n);

s=n;

for(r=1;r<=n;r++)

{

for(c=1;c<s:c++)

printf(" ");

s--;

for(c=1;c<=r;c++)

printf("  *");

printf("\n");

}

return 0;

}
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...