You're dividing 200 by 1000 as int. C should be 0
I just modified the code like this :
Cedric:
What's wrong with tiny code?🧐
#include<stdio.h>
#include<stdlib.h>
int sharingPart (int a, int b);
int main(int argc, char** argv){
int shareholders = 0;
int money = 0;
int part = 0;
printf("How much we get?\n");
scanf("%d",&money);
printf("How many we're ?:\n");
scanf("%d",&shareholders);
part = sharingPart(money,shareholders );
printf("Each of us will get %d$ as his part\n",part);
return 0;
}
int sharingPart(int a, int b){
int c = 0;
c = a / b;
return c;
}
Here's the output :
"Each of us will get 0$ as his part"🧐