cs:c_language:max3
Return to Home page
If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it
You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/c_language/max3?rev=1551188114&do=diff
Differences
This shows you the differences between two versions of the page.
— | cs:c_language:max3 [2024/04/08 22:35] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Max 3 ====== | ||
+ | **Concepts: | ||
+ | Read data (with '' | ||
+ | |||
+ | **Text:**\\ | ||
+ | Implement a C program that reads 3 floating point variables and prints the maximum value between them | ||
+ | |||
+ | **Solution: | ||
+ | |||
+ | <file C max3.c> | ||
+ | /* Program for the computation of the maximum value between 3 float numbers */ | ||
+ | |||
+ | #include < | ||
+ | |||
+ | int main() { | ||
+ | float x, y, z; /* input data */ | ||
+ | float max; /* output data */ | ||
+ | |||
+ | printf(" | ||
+ | scanf(" | ||
+ | printf(" | ||
+ | scanf(" | ||
+ | printf(" | ||
+ | scanf(" | ||
+ | |||
+ | if (x>y) /* find the maximum between x and y, and store it in the variable max */ | ||
+ | max=x; | ||
+ | else | ||
+ | max=y; | ||
+ | if(z> | ||
+ | max=z; | ||
+ | |||
+ | printf(" | ||
+ | |||
+ | return(0); | ||
+ | } | ||
+ | </ | ||
If you found any error, or if you want to partecipate to the editing of this wiki, please contact: admin [at] skenz.it
You can reuse, distribute or modify the content of this page, but you must cite in any document (or webpage) this url: https://www.skenz.it/cs/c_language/max3?rev=1551188114&do=diff