Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Need Help Right Away!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nigana




PostPosted: Tue May 12, 2009 9:55 am   Post subject: Need Help Right Away!

Turing:
var num1,dem1,num2,dem2:int
loop
put "please enter the number of the first fraction:  "..
get num1
put "please enter the denominator of the first fraction:  "..
get dem1
put "please enter the number of the second fraction:  "..
get num2
put "please enter the number of the second fraction:  "..
get dem2

if dem1 not=dem2 then
var dem:int:=dem1*dem2
var num3:int:=dem2*num1
var num4:int:=num2*dem1
put num3+num4,"/",dem
elsif dem1=dem2 then
var num5:int:=num1+num2
put num5,"/",dem1
end if
end loop


how do we simply the answer can you give us the code plz!!

Mod Edit: Remember to use syntax tags! Thanks Smile
code:
[syntax="turing"]Code Here[/syntax]
Sponsor
Sponsor
Sponsor
sponsor
nigana




PostPosted: Tue May 12, 2009 10:05 am   Post subject: Re: Need Help Right Away!

nigana @ Mon May 11, 2009 12:04 pm wrote:
can someone help me with this questions, i am really confused.



5.Write a program that inputs two fractions in the form a/b and c/d, and outputs their sum in the form p / q cancelled down to its simplest form. This should continue until the user types in an exit command of your choice.

Sample run: Input: 5/6 1/10
Output: 14/15


var num1,dem1,num2,dem2:int
loop
put "please enter the number of the first fraction: "..
get num1
put "please enter the denominator of the first fraction: "..
get dem1
put "please enter the number of the second fraction: "..
get num2
put "please enter the number of the second fraction: "..
get dem2

if dem1 not=dem2 then
var dem:int:=dem1*dem2
var num3:int:=dem2*num1
var num4:int:=num2*dem1
put num3+num4,"/",dem
elsif dem1=dem2 then
var num5:int:=num1+num2
put num5,"/",dem1
end if
end loop


how do you simply the fraction plz give the code to us !
DifinityRJ




PostPosted: Tue May 12, 2009 11:14 am   Post subject: Re: Need Help Right Away!

Please take the the time to post a well structured post, and refrain from double posting. Also try reading the guides on posting succesful help posts.

Once you've read all the guidelines, we will take the time to help you.

Thanks.
CentiZen




PostPosted: Tue May 12, 2009 11:18 am   Post subject: RE:Need Help Right Away!

Yeah, I found this post a little hard to understand. Rephrase it and then I will try to help.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: