0

Why is the result of Remainder is 0 1 instead of only 1?

#include<stdio.h> int main() { int num1,num2,div; printf("Enter First integer : 10 "); scanf("%d", &num1); printf("\nEnter Second integer : 3 "); scanf("%d", &num2); div=num1/num2; printf("\nRemainder : %d %d",num1/num2); return 0; }

3rd Nov 2021, 4:42 PM
Yvns Kito
3 ответов
0
Yvns Kito logical error, agree with A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ sir, and must change your printf statement. There should be only a single %d for reminder. printf ("Reminder: %d", num1%num2); or you can also do this div = num1 % num2; printf("Reminder: %d", div);
3rd Nov 2021, 5:29 PM
Rupali Haldiya
Rupali Haldiya - avatar
+ 1
Yvns Kito You are dividing instead of getting reminder. To get reminder use modulus operator (%) not /
3rd Nov 2021, 4:50 PM
A͢J
A͢J - avatar
0
I got the correct answer anyway by me ty for🤗
3rd Nov 2021, 5:31 PM
Yvns Kito