|
-
September 11th, 2010, 07:39 AM
#1
problem with dividing int numbers in C#
using System;
class test
{
static void Main()
{
int divident = 0;
int divisor = 0;
int division = 0;
int rest = 0;
Console.Write("divident: ");
divident = Convert.ToInt32(Console.ReadLine());
Console.Write("divisor: ");
divisor = Convert.ToInt32(Console.ReadLine());
Console.Write("division: " +division);
division = (divident / divisor);
Console.Write(" rest: " +rest);
rest = (divident % divisor);
}
}
my program always returns 0 in division and the rest and I have no idea what's wrong.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|