using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MethodExamples
{
class Program
{
static void Main(string[] args)
{
Program prog = new Program();
//prog.BasicOperators();
prog.UseGetRemainder();
}//end main
private void BasicOperators()
{
double number;
int num1=7, num2=34, num3=12;
string myName = "Steve Conger";
//The basic operators are * / + - %
// other operators ++ -- += -= *= /= %= < > != ==
number = 756.77;
double sum = number + num1;
int total = (int)number + num1;
Console.WriteLine("the double sum is {0}", sum.ToString());
Console.WriteLine("The integer total is {0}", total.ToString());
Console.ReadKey();
}//end basic operators
private int GetRemainder(int numberOne, int numberTwo)
{
int remainder;
remainder = numberOne % numberTwo;
return remainder;
}
private void UseGetRemainder()
{
Console.WriteLine("Enter your first number");
int number1 = int.Parse(Console.ReadLine());
Console.WriteLine("Enter your second number");
int number2 = int.Parse(Console.ReadLine());
int myRemainder = GetRemainder(number1, number2);
Console.WriteLine("the remainder of {0} and {1} is {2}", number1.ToString(),
number2.ToString(), myRemainder.ToString());
Console.ReadKey();
}
}//end class program
}//end namespace
No comments:
Post a Comment