Problem No. 01 Write a problem to print 100 asterisks (*) one at a time. After e
ID: 3624671 • Letter: P
Question
Problem No. 01
Write a problem to print 100 asterisks (*) one at a time. After every 10th asterisk your program should print a new line character. For example:
**********
********** so on.
Problem No. 02
Write programs to print following triangles on the screen, using loop.
*
**
***
****
*****
******
******
*****
****
***
**
*
Problem No. 03
Write a problem to print the Table of any number entered by user. For example, 2x1=2, 2x2=4, 2x3=6 or 5x1=5 5x2=10 5x3=15 etc. etc.
Problem No. 04
Write a program that reads a nonnegative integer and computes and prints its factorial. For example, user entered 5, so, factorial of 5 will be: 5! = 5.4.3.2.1 which is 120.
*
**
***
****
*****
******
******
*****
****
***
**
*
Explanation / Answer
#include #include void printAsterisks(int n); void printTriangles(int baseSize); void printTable(int n); int factorial(int n); int main() { int userInput = 0; printf("Enter total number of asterisks you would like to print: "); scanf("%d", &userInput); printAsterisks(userInput); printf("Enter the size of the base for triangles: " ); scanf("%d", &userInput); printTriangles(userInput); printf("Enter the value you would like the table of: "); scanf("%d", &userInput); printTable(userInput); printf("Enter the value you would like to compute factorial of: "); scanf("%d", &userInput); printf("Factorial of %d is %d ", userInput, factorial(userInput)); return 0; } void printAsterisks(int n) { int i; for (i = 1; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.