Question: I N THIS C PROGRAM WHAT CODE LINES COULD LEAD T O A N INTGER OVERFLOW? #include int main ( ) { int apples; int

IN THIS C PROGRAM WHAT CODE LINES COULD LEAD TOAN INTGER OVERFLOW?
#include
int main()
{
int apples;
int students;
unsigned int price =2; //2 dollars per apple
printf("Quantity of students: ");
scanf("%d", &students);
printf("Quantity of apples per student: ");
scanf("%d", &apples);
// get total apples
apples = apples * students;
// get total price
price = price * apples;
// print result
printf("The price for %d apples is $%d
", apples, price);
return 0;
}
 IN THIS C PROGRAM WHAT CODE LINES COULD LEAD TOAN INTGER

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!