Console.WriteLine("Hello, World"); //Normal Method.
//Below is the Concatenation Method.
Console.WriteLine(" The Sum Of "+a+" + "+b+" = "+c);
//Last Method.
Console.WriteLine("Sum Of {0} + {1} = {2}");
Let us now see, How to evaluate an expression like this,
( a + b ) * c
----------------
4 * d
using System;
using System.Collections.Generic;
using System.Text;
namespace prog1
{
class Program
{
static void Main(string[] args)
{
double a, b, c, d;
Console.Write("Enter the values for a: ");
a = double.Parse(Console.ReadLine());
Console.Write("Enter the values for b: ");
b = double.Parse(Console.ReadLine());
Console.Write("Enter the values for c: ");
c = double.Parse(Console.ReadLine());
Console.Write("Enter the values for d: ");
d = double.Parse(Console.ReadLine());
Console.WriteLine("The value of the expression is "+(((a+b)*c)/(4*d)));
Console.ReadLine();
}
}
}
Output:
Enter the values for a: 4
Enter the values for b: 5
Enter the values for c: 2
Enter the values for d: 4
The value of the expression is 1.125
Hi, I'm Moinuddin. I'm a Software Engineer at WIPRO working on Microsoft .NET Technology. I'm interested in a wide range of technology topics, mainly Microsoft including Windows Azure, WCF, WPF, Silverlight and any other cool technology that catches the eye.
0 comments:
Post a Comment