7974. What’s Next Problem code: ACPC10A
#include<stdio.h>
int main()
{
int a , b ,c ;
while(1)
{
scanf("%d %d %d", &a,&b,&c);
if (a==0 && b==0 && c==0)
break;
if (b-a == c-b)
printf("AP %d\n",c+(b-a));
else if(b/a == c/b)
printf("GP %d\n",c*(b/a));
}
return 0;
}
#include<stdio.h>
int main()
{
int a , b ,c ;
while(1)
{
scanf("%d %d %d", &a,&b,&c);
if (a==0 && b==0 && c==0)
break;
if (b-a == c-b)
printf("AP %d\n",c+(b-a));
else if(b/a == c/b)
printf("GP %d\n",c*(b/a));
}
return 0;
}
No comments:
Post a Comment