View Code of Problem 3495

#include <stdio.h>
#include <math.h>
#include <string.h>
int mod(int x,int y){
	while(x>=y){
		x=x-y;
	}
	return x;
	
}

int main(){
		int x,y;
		
		int temp;
		while(scanf("%d %d",&x,&y)!=EOF){
			int n=mod(x,y);
			printf("%d\n",n);
		}
	
						
}

Double click to view unformatted code.


Back to problem 3495