Write a program that asks the user to enter a fraction, then reduces the fraction to lowest terms.
寫一個程式 輸入一個分數,約分為最簡分數後輸出
Example input:
6/12
Example output:
1/2
Example input 2:
12/6
2
Hidden content!#include<stdio.h>int a,b,i,j;int main(){* * ****** * * * * ** *** ***** for(;;) * * * ** * * * * *** ** * * for(i=1;i<(a+b);i++){ ** * * * ** * * ** * * *** *** * *** *** * * ** ** * ** * *** ** **** * * * *** * * * * * * * * * ** * * ** ** ** ** * ** * * ** ** * * * * * * *** * * * *** * * ** *** * * ** * * * * * }i=1;j++;if(j==10){break;}*** ** ** * * * ** * * ** ** *** * ** *** * * * ***** ** ***** ** * * * * * * * * ** ** *** * * * * * ** ** * * ** * * * ** ** * * }
Hidden content!#include <stdio.h>#include <stdlib.h>int main(){ int a,b,count,c,d;** * * * ** * ** * * * *** ** * *** * **** * * * ** ** * * ** *** * ** * *** * * * ** * * * * * * * * * ** * * * *** ** * * * * * * * ** * * ** * * * *