+ 2

Can someone please tell me whats wrong with my code?

#include <stdio.h> int main() { int fruit; scanf("%d", &fruit); //your code goes int apples = fruit / 2; int pies = apples % 3; printf("%d", pies); return 0; }

2nd Sep 2023, 8:15 PM
Angelmar Dayangco
Angelmar Dayangco - avatar
2 Réponses
+ 6
Angelmar Dayangco , int pies = apples / 3; This is the mistake as you used (%) in place of ( /)... As (%) gives remainder
2nd Sep 2023, 8:38 PM
Riya
Riya - avatar
+ 1
Nothing it runs perfectly :D
2nd Sep 2023, 8:19 PM
Samir Krasnic
Samir Krasnic - avatar