Question 2
Using C or C++ or a program of your choice, write a program that list the storage size of a float, list the minimum and maximum float values, and the precision of the float.
Question 3
Describe the steps of how you will compile the program written in Question 2 above in a typical compiler such as gcc or a compiler of your choice. Show the output of how you have compile the program written in Question 2 above and attach all files generated where applicable.
Question 2
#include<stdio.h>
int main(){
int i=0;
float values[]={456.5464654,56.235464,1335.5464,789.465,13.56432};
float min=values[0];
float max=values[0];
for(i=1;i<5;i++){
if(max<values[i]){
max=values[i];
}
if(max>values[i]){
min=values[i];
}
}
printf("Min value is: %.5f\n",min);
printf("Max value is: %.5f\n\n",max);
return 0;
}
Question 3
Use Cygwin64 Terminal program to compile and run the program
Comments
Leave a comment