Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream.h>
- #include<fstream.h>
- #include<math.h>
- int main(){
- ifstream f1("atestat.in");
- ofstream f2("atestat.out");
- int n,x,y,z,s,i=0,cmmdc,n1;
- f1>>n;
- n1=pow(10,6);
- x=n/n1;
- n1=pow(10,3);
- y=(n/n1)%n1;
- z=n%n1;
- f2<<x<<" "<<y<<" "<<z;
- i=x%y;
- while(i!=0){
- x=y;
- y=i;
- i=x%y;
- }
- cmmdc=y;
- s=cmmdc%z;
- while(s!=0){
- cmmdc=z;
- z=s;
- s=cmmdc%z;
- }
- f2<<endl<<z;
- f2.close();
- f1.close();
- }
Add Comment
Please, Sign In to add comment