Little man computer help

  • #1
little man computer....help plzzz....urgent

can some1 pl help me write a program to perform the integer division of two numbers (dividend=divisor*quotient+remander). DIvidend and Divisor should be provided by the user, and the quotient and the remainder should be returned to the user. the user must also supply any numbers that may be required.


thanxx in advance
 

Answers and Replies

  • #2
PhY
38
0
Well depends what Language you're Writing in.

If it was Turbo pascal.
program div;
uses crt;
var
a:Integer;
b:integer;
c:integer;
begin

writeln ("Division of 2 numbers");
repeat
write (' Enter 2 numbers to divide by :');
read(a,b);
until (a,b<>0);
C:=a/b;
Writeln (' Division of ',a,' by ',b,' := ,'c);
readln;

end;

Btw ..I haven't wrote pascal in 2 years sooo....not Snippet proof.
 
  • #3
if it is in c++ you would do something like
int dividend;//given by the user somehow
int divisor;//given by the user somehow
int quotient = dividend/divisor;//performs integer division you'll get the right number
int remainder = dividend%divisor;//Modulus operator, gives you the remainder
 

Related Threads on Little man computer help

  • Last Post
Replies
6
Views
3K
  • Last Post
Replies
7
Views
2K
Replies
1
Views
1K
Replies
1
Views
924
Replies
6
Views
764
  • Last Post
Replies
2
Views
1K
Replies
2
Views
2K
  • Last Post
Replies
11
Views
2K
  • Last Post
Replies
10
Views
3K
  • Last Post
Replies
3
Views
1K
Top