Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Created by sanjayshr on 24/5/17.
- //
- /*
- *
- * Lbs to Kg
- */
- #include <stdio.h>
- #include <stdlib.h>
- struct Weight
- {
- float OneLbsinKg;
- };
- float weightConverter(float* lbss, struct Weight * POneLbsinKg)
- {
- float result;
- POneLbsinKg -> OneLbsinKg = 0.453592;
- result = *lbss * POneLbsinKg->OneLbsinKg;
- return result;
- }
- int main()
- {
- float lbs;
- float OneLbsin_Kg;
- struct Weight * PWeight = (struct Weight *) malloc(sizeof(struct Weight));
- printf("Enter weight in lbs :");
- scanf("%f", &lbs);
- if (weightConverter(&lbs, PWeight))
- {
- printf("1 Lbs : %f \n", PWeight->OneLbsinKg);
- printf("%f \n", weightConverter(&lbs,PWeight));
- }
- free(PWeight);
- }
Add Comment
Please, Sign In to add comment