Develop and execute C Program to Add Two Distances given in kilometer-meter Using Structures.
This post content:-
Algorithm
Flowchart
C code
Output
Pdf notes
Algorithm:-
Step 1:- start.
Step 2:- declare structure for km and meter.(
struct Distance {
int km;
float m;
} d1, d2, result;)
Step 3:- take input of both distances.
Step 4:- add distances.
Step 5:- convert meter to km if greater than 1000
Step 5:- print the result.
Step 6:- END.
Flowchart :-
C code:-
Output:-
Try it yourself:- online c compiler
Comments
Post a Comment