Skip to content

Commit

Permalink
add: comparing two fractions 馃殌
Browse files Browse the repository at this point in the history
  • Loading branch information
fikriks committed Oct 2, 2022
1 parent a48b99d commit 3d67211
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
31 changes: 31 additions & 0 deletions C++/ComparingTwoFractions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// fikriks

#include<stdio.h>

using namespace std;

int main()
{
int pecahan_pembilang1, pecahan_penyebut1, pecahan_pembilang2, pecahan_penyebut2;
float hasil1, hasil2;

printf("%s\n", "Membandingkan Dua Bilangan Pecahan");
printf("Masukan Bilangan Pecahan Ke-1 (Format Input = 1/2) = ");
scanf("%i/%i", &pecahan_pembilang1, &pecahan_penyebut1);

printf("Masukan Bilangan Pecahan Ke-2 (Format Input = 1/2) = ");
scanf("%i/%i", &pecahan_pembilang2, &pecahan_penyebut2);

hasil1 = (float) pecahan_pembilang1 / pecahan_penyebut1;
hasil2 = (float) pecahan_pembilang2 / pecahan_penyebut2;

if(hasil1 == hasil2){
printf("Pecahan Ke-1 (%i/%i) Sama Dengan Pecahan Ke-2 (%i/%i)", pecahan_pembilang1, pecahan_penyebut1, pecahan_pembilang2, pecahan_penyebut2);
}else if(hasil1 < hasil2){
printf("Pecahan Ke-1 (%i/%i) Lebih Kecil Dari Pecahan Ke-2 (%i/%i)", pecahan_pembilang1, pecahan_penyebut1, pecahan_pembilang2, pecahan_penyebut2);
}else if(hasil1 > hasil2){
printf("Pecahan Ke-1 (%i/%i) Lebih Besar Dari Pecahan Ke-2 (%i/%i)", pecahan_pembilang1, pecahan_penyebut1, pecahan_pembilang2, pecahan_penyebut2);
}

return 0;
}
14 changes: 3 additions & 11 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

# Message
<p>Enter your Name, Github Link & Your E-Mail Address in the given format. Don't try to change anything else!!!</p>
<code>| Name | Github Link | E-Mail Address |</code>
<code>| Name | Github Link | E-Mail Address |</code>

# List of Contributors

<p>[*] Make sure you have updated your Name, Github link & E-Mail Id (enter your e-mail just after mailto:)!!!</p>
<br>

Expand All @@ -29,16 +30,7 @@
| Rahul Jangle | <a href="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/Rronny01/">Ronny</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Anurag Vats | <a href="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/AnuragVats007">Anurag Vats</a> | <a href="mailto:[email protected]">E-Mail</a> |
| Daksh Kesarwani | <a href="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/InnocentDaksh63">Daksh kesaarwani</a> | <a href="[email protected]">E-Mail</a> |










| Daksh Kesarwani | <a href="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/fikriks">Fikri Khairul Shaleh</a> | <a href="[email protected]">E-Mail</a> |

<br>
<h1>
Expand Down

0 comments on commit 3d67211

Please sign in to comment.