Afişează mesaje
Pagini: [1]
1  infoarena - concursuri, probleme, evaluator, articole / Arhiva de probleme / Răspuns: 001 CMMDC : Octombrie 01, 2014, 11:40:14
Salut,am scris programul ,dar ni functioneaza:( cineva pot sa ajut ,pentru ca nu stiu ce este problema ?

#include <fstream>
#include "stdio.h"
 using namespace std;

int lnko(int z,int y)
{
   int tmp;
 
   if (z<0) z= -z;
   if (y<0) y= -y;
   while(y > 0) {
      tmp = y;
      z = z % y;
      z = tmp;
   }
   return z;
}
 
int main()
{
    ifstream f("cmmdc.in"); 
    ofstream g("cmmdc.out");
 int a,b,e;
  f >> a >> b;
 
e = lnko (a,b);
 if (e>30000)
 return 0;
 else{
  g << e << '\n';
 g.close();
  return 0; 
}}
Pagini: [1]
Powered by SMF 1.1.19 | SMF © 2006-2013, Simple Machines