Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. /*
  2. 1. Begin
  3. 2. Let productsum equal 0
  4. 3. User is asked to enter two integers
  5. 4. Let product equal to the product of the two integers
  6. 5. Let productsum equal to the sum of productsum and product
  7. 6. If both integers are greater than 0, print the value of product and the value of product sum.; goto 3
  8. 7. If both integers are equal to zero, print the value of both integers
  9. 8. End
  10. */
  11.  
  12. #include <stdio.h>
  13. int main() {
  14. int a;
  15. int b;
  16. int product;
  17. int productsum=0;
  18.  
  19.  
  20. do {
  21.  
  22.  
  23. printf("Enter two integers: ");
  24. scanf("%d%d", &a,&b);
  25.  
  26.  
  27. product=a*b; //
  28. productsum+=product;
  29. if(a!=0||b!=0){
  30.  
  31. printf("%d*%d=%d;the sum of products=%d\n",a,b,product,productsum);
  32. }
  33. }
  34.  
  35. while(a!=0||b!=0);
  36. printf("You entered: %d %d", a,b);
  37.  
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement