Kattis Solution to mixed fraction in cpp

mixedfractions.cpp




#include<bits/stdc++.h>
using namespace std;
int main(){
long numerator,denominator;
while(cin >> numerator >> denominator && numerator != 0 && denominator != 0 ){
if(numerator < denominator){
cout << "0 " << numerator << " / " << denominator << "\n";
}else{
cout << numerator/denominator << " "<< numerator%denominator << " / " << denominator << "\n";
}
}
return 0;
}
Problem link:https://open.kattis.com/problems/mixedfractions

Comments

Popular posts from this blog

Basketball One-on-One : Kattis Solution in C++

Kattis Solution to Reverse Binary in C++

Kattis Solution to Odd Man out In cpp