1 like 0 dislike
18k views

Use C program to print out a star-triangle below:

*
**
***
****
*****
[Exercise] Coding (C) - asked in Chapter 1: Introducing C by (12.1k points)
ID: 25286 - Available when: Unlimited - Due to: Unlimited
| 18k views

92 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
** *** *** * ******* *** ** * *** * * *** *
* * ** **** *** * * * * * ** * * * * * *
* * * *** * * ** ** *** * ** * *
** ***** ** ** ** * ** * ***** ** *
********* * * * ****** * ** ** * * * *
}
answered by (-214 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
*** *** * ** ** * ** * ** ** *
* * * * **** * ** ** *** * ** * * **
**** ** ** * ***** * ** * *** * * * **
* **** * *** ****** ** ** * * *** *
** * * ** * * * ** * **** ** * * ******

}
answered by (-214 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include * **** * * **

int main(void)

{
** * *** * * ** ** * * ** *** ** **** * *** ***** * ** *
* **** ***** * * 0;
}
answered by (-16 points)
edited by
0 0
Case 0: Correct output
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
** * * *** * *

int * *** *

{

* * *** ** ** * * * ** * *
0;

}
answered by (-249 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()

{
* ** ***** * * * * ** n=1,counter=1;

* * * ** ***** ** * (n;n<=5;n++)
    {
** * * ** * *** *** ** * * * *** *
*** * * * * **** ** * *** * ** * **** * ** (counter;counter<=n;counter++)
* * ** ** * ** * *** ** * * ** **** * * ** *
* *** * * *** * ** * ** ** * * * * * * * * * *** ***** * * *** * * * * * *
** * * ** **** ** ******* * * ** ** * ****** ** *
* * * *** * * * * * * *** ** ** ** **** ** ** ** (n<5)
* ** * * **** * * * * ** ** * *** * **** *
* * ** ** * * * * * * * ** * * * ***** * * * ****** *** ** * **
* * **** * * * ** * **** * * *** ***
    }
* * * * * *** * 0;
}
answered by (-249 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()

{
** ** **** * **** *** n=1,counter=1;

**** * * * ** * ** * * * (n;n<=5;n++)
*** * ** * *** * * ***
** *** ** * * * *** * * ** ** * * ** * * ** **
********* **** * * * * **** ****** ** * ** * * (counter;counter<=n;counter++)
****** * * * ** ** *** *** ** * * ****** *
* ** ** * ** *** ** ** * * *** ***** * * ****** ** * * ****** ** ******
**** * * * **** *** * * ** * * * * * * ***
** * * * ** ** ***** **** * ** * * *** *** ** * ***
    }
* *** * * * * ** * **** 0;
}
answered by (-249 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include ** * ** * * *
int main()
{
***** * * * * * * i, m=5, j;
* ** * * * ** * **** ** *** *** * *
** ** *** ****** ** ** * * (i=1;i<m;i++)
{
* ****** *** * ***** *** * ** *** * * * ** **
* * **** * * *** * ** ** ** (j=0;j<=i;j++)
* ***** * *** ***** * * * ***** * * * * ** ** * ** ** ** * ** **
}
** ** ** * ******** * ** 0;
}
answered by (-168 points)
0 0
Case 0: Correct output
0 like 0 dislike
Hidden content!
#include *** ** * * * **
**
int main() {
** ** **
* * * ** *** n, c, k;
* *
** * * ** ** n: * * **
*** * ** *** **** *** **** * * **
** * *
* * * ** ** (c = 1; c <= n; c++) {
****
** * * ** * * * * * (k = 1; k <= c; k++)
** * * * ** ****** * * * * *** ** ** * ******
* * ****
* *** ** * * *** *** ** * ** ** ** * ***
** ** * *
*** ***
*** * * * ** 0;
}
answered
0 0
prog.c: In function 'main':
prog.c:7:2: error: stray '\302' in program
  \xc2\xa0printf("Enter n: \n");
  ^
prog.c:7:3: error: stray '\240' in program
  \xc2\xa0printf("Enter n: \n");
   ^
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main ()
{

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

* * * ** * * *** * 0;

}
answered by (-167 points)
0 0
Case 0: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main()
{
* * * * **** ** * * i, j, rows = 4;
** * * * * *** * ** ** * i<=rows; ++i)
* * ******* ** * * ** *
* *** * * * * ** * ***** * * * * * ** ** j<=i; ++j)
* * * ** ** **** ***** ***** ** * * ** ***
* ** *** ****** * ** ******* ** ** ** ** * *** ** * ** ***** ** ** *** ** *****
** **** **** * ** * * * ** ** ** ** * *
* ** *** * ** * ** * *** *** * * * *** * **** * ** * * *** *
    }
*** **** ** * * * * * * * * * * * *** ** * *** ***** * ****
****** * * *** ** * 0;
}
answered by (-168 points)
0 0
Case 0: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:104.23.197.95
©2016-2026

Related questions

1 like 1 dislike
93 answers
[Exercise] Coding (C) - asked Sep 21, 2017 in Chapter 1: Introducing C by thopd (12.1k points)
ID: 25287 - Available when: Unlimited - Due to: Unlimited
| 44.6k views
0 like 0 dislike
0 answers
[Resource] asked Oct 14, 2017 in Chapter 1: Introducing C by thopd (12.1k points)
ID: 26946 - Available when: Unlimited - Due to: Unlimited
| 13 views
12,783 questions
183,442 answers
172,219 comments
4,824 users