baby_1
Advanced Member level 1
Hello
here is my program
if i type 8 and 3 the result is 2 .
if i changed the one of the baby function argument to float it works fine(2.66667).why this code doesn't work properly with cast tranform ( f=(float)(x/y))
i want to do PIC microcontroler programming with C language and i want to decrease my variable bit.
Thanks
here is my program
Code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <math.h>
#include <string.h>
void baby(int x,int y);
int main(void)
{
int x,y;
scanf("%d%d",&x,&y);
baby(x,y);
scanf("%d",&x);
}
void baby(int x,int y)
{
float f;
f=(float)(x/y);
printf("%f",f);
}
if i type 8 and 3 the result is 2 .
if i changed the one of the baby function argument to float it works fine(2.66667).why this code doesn't work properly with cast tranform ( f=(float)(x/y))
i want to do PIC microcontroler programming with C language and i want to decrease my variable bit.
Thanks