Advertisement
Mary_99

Division a/b

Nov 25th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int a , b ;
  6. char z ,tmp[10];
  7. printf("Program checks divisibility a through b\n");
  8. printf("Enter a pair of integer numbers");
  9. do{
  10. {
  11.     printf("enter a =");
  12.     scanf("%s",&tmp);
  13. }
  14. while(atoi(tmp)==0);
  15. a = atoi(tmp);
  16. do
  17. {
  18.     printf("enter b =");
  19.     scanf("%s",&tmp);
  20. }
  21. while(atoi(tmp)==0);
  22. b = atoi(tmp);
  23. if((a%b) == 0) printf(" Number a = %d is divisible through b = %d",a,b);
  24. else printf(" Number a = %d is not divisible through b = %d",a,b);
  25. printf("\nContinoe? (n-finish)\n");
  26. z = getchar();
  27. }while((z!='n')&&(z!='N'));
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement