Answer to Question #302664 in C for Sasi

Question #302664

Write a C program to print weight and height of a person using typedef.


Runtime Input :


Weight: 50.5


Height: 7.2

1
Expert's answer
2022-02-25T10:29:23-0500
#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);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS