Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 1. Begin
- 2. Let productsum equal 0
- 3. User is asked to enter two integers
- 4. Let product equal to the product of the two integers
- 5. Let productsum equal to the sum of productsum and product
- 6. If both integers are greater than 0, print the value of product and the value of product sum.; goto 3
- 7. If both integers are equal to zero, print the value of both integers
- 8. End
- */
- #include <stdio.h>
- int main() {
- int a;
- int b;
- int product;
- int productsum=0;
- do {
- printf("Enter two integers: ");
- scanf("%d%d", &a,&b);
- product=a*b; //
- productsum+=product;
- if(a!=0||b!=0){
- printf("%d*%d=%d;the sum of products=%d\n",a,b,product,productsum);
- }
- }
- while(a!=0||b!=0);
- printf("You entered: %d %d", a,b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement