Write a C program to print weight and height of a person using typedef.
Runtime Input :
Weight: 50.5
Height: 7.2
#include <stdio.h>
typedef struct {
float weight;
float height;
} person;
int main()
{
person pers;
printf("Enter weight: ");
scanf("%f", &pers.weight);
printf("Enter height: ");
scanf("%f", &pers.height);
printf("\n");
printf("Weight: %.1f\n", pers.weight);
printf("Height: %.1f\n", pers.height);
}
Comments
Leave a comment