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; }
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);
+ 1
Yvns Kito
You are dividing instead of getting reminder. To get reminder use modulus operator (%) not /
0
I got the correct answer anyway by me ty for🤗