Write a program that prompts the user to enter a positive integer number and a c
ID: 3690010 • Letter: W
Question
Write a program that prompts the user to enter a positive integer number and a character. The program prints three triangles of stars separated by the entered character. Each triangle should have a number of star lines equal to the entered integer. Write a program that generates random integers in the range of 300 to 1370. The program checks and prints each integer which is divisible by 9. Your program checks for an integer whether it is divisible by 9 as follows: an integer is divisible by 9 if the sum of its digits is divisible by 9; for example 1629 is divisible by 9 since 1 + 6 + 2 + 9 = 18 and 18 is divisible by 9. You can use the modulus operator to check the sum only. Your program terminates when the user enters the word lamDone.Explanation / Answer
1.
#include<stdio.h>
#include<conio.h>
int main() {
int i,j,rows;
char ch;
int p=0
printf(" please Enter the number of rows ");
scanf("%d", &rows);
printf("Enter the character here ");
scanf("%c", &ch);
while(p<3) // to print 3 triangles now
{
for(i = 1; i <= rows; i++) {
/* Prints one row of triangle */
for(j = 1; j <= i; ++j) {
printf("* ");
}
printf("ch");
p++;
}
}
getch();
return 0;
}
2.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.