Answer to Question #283527 in C++ for Jen

Question #283527

Write a program in c# that will accept 10 numbers. The program will then compute and display the sum of the odd and even numbers


1
Expert's answer
2021-12-29T13:37:14-0500
using System;  
public class Exercise4  
{  
    public static void Main() 
{       
    int i,n,sum=0;
 double avg;
 
 Console.Write("\n\n");
    Console.Write("Read 10 numbers and calculate sum and average:\n");
    Console.Write("----------------------------------------------");
    Console.Write("\n\n");
 
 Console.Write("Input the 10 numbers : \n");
 for (i=1;i<=10;i++)
 {
                Console.Write("Number-{0} :",i);



        n= Convert.ToInt32(Console.ReadLine());  
  sum +=n;
 }
 avg=sum/10.0;
 Console.Write("The sum of 10 no is : {0}\nThe Average is : {1}\n",sum,avg);
   }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog