This repository has been archived on 2023-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
VSMechatronics/C4/correct_answer.c
2022-04-08 16:12:38 +01:00

20 lines
393 B
C

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
// Declare and initialise as required
int a = 1,b = 4;
float ans;
// Perform calculation
// This time a & b are treated as if they are floats
// the result of this float calculation is stored in ans
ans = (float)a / (float)b;
// Display answer
printf ("\nThe answer is %f",ans);
return 0;
}