Answer to Question #21699 in C# for tofik mohamed
write a program that reads three integers from the keyboard and outputs their sum and product
1
2013-01-09T08:30:19-0500
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Question21699
{
class Program
{
static void Main(string[] args)
{
double[] arrayofnumbers=new double[3];
double sum=0;
double product = 1;
for(int i=0;i<3;i++){
Console.Write("Enter number {0}: ", (i+1));
arrayofnumbers[i] = int.Parse(Console.ReadLine());
}
for (int i = 0; i < 3; i++) {
sum += arrayofnumbers[i];
product *= arrayofnumbers[i];
}
Console.Write("Sum = {0}", sum);
Console.Write("
Product = {0}", product);
Console.ReadLine();
}
}
}
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!
Learn more about our help with Assignments:
C#
Comments
Leave a comment