Hello guys, i have a c++ homework and iam facing some problems, so if anyone can help me with these question i'll appreciate it. regards, Emad These are the questions: 1- Write a program that reads five numbers (each between 1 and 30). For each number read, your program should print a line containing that number of adjacent asterisks. For example, if your program reads the number seven, it should print *******. Your screen should appear as follows: Enter 5 numbers between 1 and 30: 5 12 8 6 11 ***** ************ ******** ****** *********** 2- The factorial function is used frequently in probability problems. The factorial of a positive integer n (written n! and pronounced ''n factorial'') is equal to the product of the positive integers from 1 to n. Write a program that evaluates the factorials of the integers from 1 to 5. Print the results in tabular format. What difficulty might prevent you from calculating the factorial of 20? Your screen should appear as follows: x Factorial of x 1 1 2 2 3 6 4 24 5 120
Have you studied loops yet? because the first one is fairly trivial and can be done in just about 4 or 5 lines of codes. I suggest you start here: cplusplus.com/doc/tutorial/control/ sorry for the badly formated link, but when I tried to send the post for some reasons the system flags my post as spam
Hey man here is the complete solution Don't worry ask your questions here but next time do homework yourself if you are interested in programming Code: #include<conio.h> #include<stdio.h> void main() {int a,b,c; clrscr(); for(c=1;c<=5;c++) { printf("\nEnter the number between 1 and 30 \n"); scanf("%d",&b); if(b>1&&b<30) { for(a=1;a<=b;a++) { printf("*"); }printf("\n"); }else printf("Entered number is out of range\n"); }getch(); }
hello emad......... if u didn't get the these question's answers....then tell me...... i'll give u the answers....... m interested in programming.......plz give me gud question....... hav a nic day......