Help

Discussion in 'C++' started by emad, Nov 22, 2010.

  1. emad

    emad New Member

    Joined:
    Nov 22, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    :)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
     
  2. servalsoft

    servalsoft New Member

    Joined:
    Apr 17, 2010
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    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 :(
     
  3. techgeek.in

    techgeek.in New Member

    Joined:
    Dec 20, 2009
    Messages:
    572
    Likes Received:
    19
    Trophy Points:
    0
    Occupation:
    EOC (exploitation of computers)..i m a Terminator.
    Location:
    Not an alien!! for sure
    Home Page:
    http://www.techgeek.in
    Please show some efforts from ur side as well..these programs are very easy...
     
  4. go4expert

    go4expert Moderator

    Joined:
    Aug 3, 2004
    Messages:
    306
    Likes Received:
    9
    Trophy Points:
    0
    We are not here to do your homework but if do it you can ask here when stuck.
     
  5. danyald

    danyald New Member

    Joined:
    Aug 2, 2010
    Messages:
    39
    Likes Received:
    1
    Trophy Points:
    0
    Home Page:
    http://www.DCOMsoftwares.tk
    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(); }
     
  6. sandeep gill

    sandeep gill New Member

    Joined:
    Dec 15, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    punjab
    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......
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice