Monday
July 28, 2014

Homework Help: C programming

Posted by jen on Thursday, October 9, 2008 at 9:29pm.

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);
}
}

Answer this Question

First Name:
School Subject:
Answer:

Related Questions

math-word problems with quadratics - I have 5 questions... 1) The sum of two ...
Math - When factoring a trinomial that is in the format Ax^2 + Bx + C, the ...
high school (math) - Match the mathematical expression with its translation. 1. ...
Math - Suppose you have two numbers. The difference of the two numbers is 12. ...
Integers - Suppose a1, a2, . . . , an is a list of n numbers with the following ...
programming - 1. Write a structured algorithm that prompts the user to input two...
Algebra - kaylin throws two dice. the difference in face value between the two ...
algebra - Stacey throws two dice. The difference in face value between the two ...
Math 8th grade - I NEED THESE IN ALGEBRAIC EXPRESSION!! The larger of two sums ...
Programming - Read two numbers from the keyboard Display the menu options as ...

Search
Members