C programming

posted by .

Enter two integers between 1 to 10
3
4
Both numbers are less than 5.
The sum of two numbers is:-1081825676
The product of two numbers is:-1081825680


why are the sum and product so weird?


my code:
#include <stdio.h>
int main()
{
int x;
int y;
int z;
int p;
int count=1;

printf("Enter two integers between 1 to 10\n");
scanf("%i%i", &x, &y);

z=x+y;
p=x*y;

while (count <=4)
{
if((x<10) && (y>10)){
printf("You did not enter a number between 1 and 10.\n");
printf("Please try again.\n");
}
else
{
if (x>=5 && y>=5)
{
printf("Both numbers are greater than 5.\n");
}
if (x<=5 && y<=5)
{
printf("Both numbers are less than 5.\n");
}
if (x>=5 && y<=5)
{
printf("The value of the first %i is greater than or equal to 5.\n");
}
if (x<=5 && y>=5)
{
printf("The value of the second %i is greater than equal to 5.\n");
}

printf("The sum of two numbers is:%i\n",&z);
printf("The product of two numbers is:%i\n",&p);
count+=1;
}
printf("Enter two integers between 1 to 10.\n");
scanf("%i%i", &x, &y);
}
}

  • C programming -

    #include <stdio.h>
    int main()
    {
    int x;
    int y;
    int z;
    int p;
    int count=1;

    printf("Enter two integers between 1 to 10\n");
    scanf("%i%i", &x, &y);

    z=x+y;
    p=x*y;

    while (count <=4)
    {
    if((x<10) && (y>10)){
    printf("You did not enter a number between 1 and 10.\n");
    printf("Please try again.\n");
    }
    else
    {
    if (x>=5 && y>=5)
    {
    printf("Both numbers are greater than 5.\n");
    }
    if (x<=5 && y<=5)
    {
    printf("Both numbers are less than 5.\n");
    }
    if (x>=5 && y<=5)
    {
    printf("The value of the first %i is greater than or equal to 5.\n");
    }
    if (x<=5 && y>=5)
    {
    printf("The value of the second %i is greater than equal to 5.\n");
    }

    printf("The sum of two numbers is:%i\n",&z);
    printf("The product of two numbers is:%i\n",&p);
    count+=1;
    }
    printf("Enter two integers between 1 to 10.\n");
    scanf("%i%i", &x, &y);
    }
    }

  • how do i post my code -

    it's not working

  • C programming -

    Thank you for using the Jiskha Homework Help Forum. Although this is definitely not my area, perhaps the following tutorials will help you:

    1. http://www.iu.hio.no/~mark/CTutorial/CTutorial.html

    2. http://www.cprogramming.com/tutorial.html

    3. http://www.physics.drexel.edu/students/courses/Comp_Phys/General/C_basics/

    Why don't you try a GOOGLE Search for "C programming tutorials?" I don't even know enough to select the best ones for you!

    Sra

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. math-word problems with quadratics

    I have 5 questions... 1) The sum of two numbers is 12. Their product is 36. Find the two numbers. 2) The sum of two numbers is -15. Their product is -100. Find the two numbers. 3) The sum of two numbers is -8. Their product is 12. …
  2. math

    Find the two numbers that multiply to the product number and add to the sum number of the following: a)Product 563033256; Sum 51895 b)Product -43481220; Sum 28429 c)Product 2545124358; Sum -105619 I tried xy = product and x+y = sum, …
  3. Math

    When factoring a trinomial that is in the format Ax^2 + Bx + C, the number that is represented by B should be viewed as the _____?
  4. Math -- 6th Grade

    The sum of two decimal numbers is 5.3. Their difference is 1.7, and their product is 6.3. What are the two numbers?
  5. Integers

    Suppose a1, a2, . . . , an is a list of n numbers with the following properties: The sum of those n numbers is 500. The sum of the smallest three of those numbers is 48. The sum of the largest two of those numbers is 35. (Note: There …
  6. high school (math)

    Match the mathematical expression with its translation. 1. the product of two numbers 2. y divided by x 3. six less than a number is y 4. x subtracted from y 5. the sum of two numbers is six 6. x minus y 7. the sum of x and y 8. x …
  7. programming

    1. Write a structured algorithm that prompts the user to input two numbers. The algorithm should calculate and print the sum & product of the two numbers [21/2]
  8. math

    the sum of two numbers exceeds their product by one. their differences is equal to their product less five . find the two numbers
  9. mathematics-Algebra

    I think of two whole numbers;the product of the average of the sum and difference of the numbers and the difference of the sum and difference of the numbers is 12.if three times the first added to the second makes up 11..find the two …
  10. Math

    The sum of two numbers is five. The sum of the squares of the two numbers is thirteen. Find the two numbers. (Enter your answers as a comma-separated list.)

More Similar Questions