Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void) {
- int a,b,c,i,maksimum=1000000000,snwd=0,nwd=0,x=0,y=0,ostatni;
- scanf("%i %i %i", &a, &b, &c);
- for (i=1;i=maksimum;i++)
- {
- if (c==1)
- {
- {
- if (a==1 || b==1)
- {
- snwd=snwd+ostatni;
- }
- else
- {
- x=a;
- y=b;
- nwd=x%y;
- while (nwd!=0)
- {
- x=y;
- y=nwd;
- nwd=x%y;
- }
- ostatni=y;
- snwd=snwd+y;
- }
- }
- scanf("%i", &c);
- }
- else if (c>1)
- {
- a=b;
- b=c;
- scanf("%i", &c);
- }
- else if (c==0)
- {
- break;
- }
- }
- printf("%i", snwd);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement