In this article I would like to share about arithmetic operators in C# programming languages. I hope you will find my work useful.
My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com
Program Listing
using System;
namespace Aritmetic_Operators
{
class Program
{
static void Main(string[] args)
{
// Arithmetic Operators in C#
// Jake Rodriguez Pomperada,MAED-IT, MIT
// www.jakerpomperada.com
// www.jakerpomperada.blogspot.com
// jakerpomperada@gmail.com
// Bacolod City, Negros Occidental Philippines
int a = 40;
int b = 6;
int sum = a + b;
int sub = a - b;
int mul = a * b;
float div = (float)a / (float)b;
int rem = a % b;
Console.WriteLine("\n\n");
Console.WriteLine("\tArithmetic Operators in C#");
Console.WriteLine("\n");
Console.WriteLine("\tThe Addition of {0} and {1} is = {2}", a, b, sum);
Console.WriteLine("\tThe Subtraction of {0} and {1} is = {2}", a, b, sub);
Console.WriteLine("\tThe Multiplication of {0} and {1} is = {2}", a, b, mul);
Console.WriteLine("\tThe Division of {0} and {1} is = {2}", a, b, div);
Console.WriteLine("\tThe Remainder of {0} and {1} is = {2}", a, b, rem);
Console.WriteLine("\n");
Console.WriteLine("\tEnd of Program");
Console.ReadLine();
}
}
}
No comments:
Post a Comment