none
C# Adding integers, averages of numbers and the difference of these numbers RRS feed

  • Question

  • My instructor has a program he wanted me to create and I am having difficulties..I am new to this and trying to understand. I am having problems with the sum, average, product and the difference on how to write the code exactly

    Enter a number...4
    Total numbers inputted so far = 1
    Enter another number...50
    Total numbers inputted so far =2
    Enter another number...51
    Total numbers inputted so far =3
    Enter final number...3
    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Total Numbers Entered is 4
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    The Sum of the numbers is...108
    The Difference of the Numbers is...-100
    The Average of the Numbers is...27
    The Product of the numbers is...30600
    The result of Special Case 1 is...2562
    The result of Special Case 2 is...-54
    ------------------------------------------------------------------------------------------------------------------------------------------------
    Are these numbers less than 50?
    -------------------------------------------------------------------------------------------------------------------------------------------------
    Number 1 = YES
    Number 2 =NO
    Number 3 = NO
    Number 4 =YES
    (Here are the calculations of the special case 1 and special case 2....1. Find the products of numbers 2 and 3 and numbers 1 and 4 
    and add them together in that order.
    a. This all needs to be done in the code
    2. Find the products of numbers 2 and 4 and numbers 1 and 3 
    and subtract them in that order.
    a. This all needs to be done in the code
    If the average has a decimal, it must show the text to display the 
    remainder. If there is no decimal, then the remainder text does not 
    need to show. 
    Don’t forget about the Console.Readline() at the end or else you
    In my book...in chapter 3 It says..Another C# APP: Adding Integers
    Displaying the sum of two numbers input from the keyboard
    in the ex , in the console window it writes
    int number1; // declare the first number to add
    int number2; // declare the second number to add
    int sum; declare  the sum of number1 and number2
    then..
    Console. Write( " Enter first integer: "); // prompt user
    //read first number from user
    number1 = Convert.ToInt32( Console.ReadLine() );
    Console.Write( "Enter second integer; "); //prompt user
    //read second number from user
    number2 = Convert.ToInt32_Console.Readline() );
    sum = number1 + number2; //add numbers
    Console.WriteLine( "Sume is {0}" , sum);  //display the sum
    I am really confused exactly how to do the difference and the average...since example of sum in book think i can do that but the difference and average etc...
    would it be on one line........ difference = 4-50-51-3;

    Console.Write( "The Difference of the numbers is...{0}" , difference);  ????


    Thursday, September 5, 2013 3:54 PM

Answers