Advertisement
iasmina_sarac

Untitled

Dec 3rd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include<iostream>
  2. #include<fstream>
  3. using namespace std;
  4. struct fractii
  5. {
  6. int n,N;
  7. }v[51];
  8. void citire()
  9. {
  10. int nr_fractii, i;
  11. ifstream.fin("fractii.in");
  12. fin>>nr.fractii;
  13. for(i=1;i<nr_fractii;i++)
  14. fin>>v[i].n>>v[i].N;
  15. }
  16. int cmmdc(int a, int b)
  17. {
  18. int r;
  19. while(b<a)
  20. {
  21. r=a%b;
  22. a=b;
  23. b=r;
  24. }
  25. return r;
  26. }
  27. int cmmmc(int a, int b)
  28. {
  29. int cmmdc, cmmme;
  30. cmmdc=cmmdc(a,b);
  31. cmmme=a*b/cmmdc;
  32. return cmmmc;
  33. }
  34. void afisare_ired()
  35. {
  36. int i,x;
  37. for(i=1;i<=nr_fractii;i++)
  38. {
  39. i=cmmde(v[i].n, v[i].N);
  40. cout<<v[i].n/x<<" "<<v[i].N/x<<"\n";
  41. }
  42. }
  43. int suma()
  44. {
  45. int i, cmmmc, cmmdc;
  46. for(i=1;i<nr_fractii;i++)
  47. cmmmc=cmmmc(v[i].n,v[i].N)
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement