Problem solving few assignments in C language

Home Forums C Programming Problem solving few assignments in C language

This topic contains 4 replies, has 3 voices, and was last updated by  NAYAN 10 years, 10 months ago.

  • Author
    Posts
  • #1987

    mulayim
    Member

    Hey,
    I have this problem. I have to 25 assignments in C language but there still are 9 assignments I can’t solve. I’m not good at the C language. In most cases I know what the program is supposed to do but I can’t seem to find the right code to use.
    Can somebody help me out?
    The Assignments are listed below:
     
    17. Write a program were you put in a number via scanf. The program must give an output (via printf) from the sum of all the numbers from 1 to the number from the input. So if I would enter 5 for the input. The output should be 1+2+3+4+5 = 15
     
    18. Make a program wich determines the sum of a few whole numbers entered via the keybord. The entered numbers must end with a zero. Use a While loop.
     
    19. Write a program using a for loop wich gives the following output:
        *
        **
        ***
        ****
        *****
        Use for printf only printf(‘*’). so for the number of stars a loop is required.
     
    20. Ajust the last program so the following output apears:
       *
       **
       ***
       *****
       Use the if else statement
     
    21. We start with a function that doesn’t give a value back to the main program. Make a function that recalculates a weight in Kilogram entered by the keybord into gram and print it on the screen. 
    22. Make a function that asks a number for the input and for the output it should multiply itself. So the quadrat??(don’t know the word in english) of the input.
    23. Make a program that calculates the the sum of the numbers 1 till n. The value of n must be entered by the user. Use loops and make youre own function to keep the program clear and easy to read.
    24. For straightcorner triangles the pythagoras statement determines. The sum of the quadrates of the straightcorners sides is equal to the quadrate of the length of the long side. Make a prgram that finds al the integers for the sides, just like the familliar triangle 3,4,5(5^2 = 3^2 + 4^2). Limit youre search for sides with a maximum length of 100.
    25. The syracusrow is a row of numbers starting with with a positive integer. The next number is determined as below:
    If the number isn’t even: next number = number *3+1
    If the number is even: Next number = number /2
    The syracusrow starting with number 22 looks like this:
     
    22  11  34   17   52   26   13   40   20   10   5   16   8   4   2   1
     
    First make a complete and clear working design for a program that prints the syracusrow on the screen for the number from the input.
    You would really help me with this because I’m like really stressing out right now.

    Thanks!
     
    Herman

  • #3235

    bhavin
    Member

    Question 19 answer:

    output:
    *
    *****
    ****
    *****

  • #3236

    bhavin
    Member

    qution no 20: answer

    output:
    *
    **
    ***
    *****

  • #3237

    bhavin
    Member

    Q.21 answer:

    output:
    enter any weight in kg 2

    gram value is = 2000grams

  • #3238

    NAYAN
    Member

    question no:17 answer

You must be logged in to reply to this topic.