Cod sursa(job #46367)

Utilizator dj_vladootzCostica Vlad dj_vladootz Data 2 aprilie 2007 16:39:34
Problema Next Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.43 kb
#include<fstream.h>
unsigned long long int n,d,m,b=1;

unsigned long int div (unsigned long int a,unsigned long int b)
	{
	int c=0;
	if (a%b==0) c=1;
	return c;
	}
unsigned long int main () 
	{
	ifstream citeste ("next.in");
	ofstream scrie ("next.out");
	citeste>>n>>d;
	m=n;
	if (div(m,d)==1) scrie<<m;
	   else
		{
		b=1;
		while (b==1)
			{
			m++;
			if (div(m,d)==1) b=0;
			}
		}
	scrie<<m;
	return 0;
	}