fork download
  1. #include <stdio.h>
  2.  
  3. int func()
  4. {
  5. int i;
  6.  
  7. while(1) {
  8. printf("input plus integer = ");
  9. scanf("%d",&i);
  10. if(i>0) {
  11. printf("ok\n");
  12. return i;
  13. }
  14. };
  15. }
  16.  
  17. int surplusPower(int b,int e,int m)
  18. {
  19. int r=b%m;
  20.  
  21. while(--e)
  22. r=(r*b)%m;
  23.  
  24. return r;
  25. }
  26.  
  27.  
  28. int main()
  29. {
  30. printf("result = %d\n",surplusPower(func(),func(),func()));
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0.01s 1724KB
stdin
-2
0
123
0
-11
456
-23
0
789
stdout
input plus integer = input plus integer = input plus integer = ok
input plus integer = input plus integer = input plus integer = ok
input plus integer = input plus integer = input plus integer = ok
result = 51