1.10: Equivalent Operations
OBJECTIVE
Write a C# program to ask the user for three numbers (a, b, c) and display the result of (a+b)·c and the result of a·c + b·c
RESOLUTION
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace My3Development { public class EquivalentOperations { public static void Main(String[] args) { int num1, num2, num3; Console.Write("Enter first number: "); num1 = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter second number: "); num2 = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter third number:"); num3 = Convert.ToInt32(Console.ReadLine()); Console.Write("Result of operation between {0}, {1} and {2}, (a+b)·c is {3} and a· b + a·c is {4}", num1, num2, num3, ((num1+num2)*num3), (num1*num3+num2*num3)); Console.ReadKey(); } } }
0 comments :
Please Enter best of your Comments