/*Exercise 3 Write a function called findMin that will 1- take three integers as input 2- find the minimum amongst three numbers 3- print the minimum on the scree Hint: the function header will be void findMin (int n1, int n2, int n3)*/ #include <stdio.h> #include <stdlib.h> #include <math.h> void findMin (int number1, int number2, int number3); int main() { int number1; int number2; int number3; int minimum; printf("please enter number1: "); scanf("%d",&number1); printf("please enter number2: "); scanf("%d",&number2); printf("please enter number3: "); scanf("%d",&number3); if(number1<=number2 &&number1<=number3) { minimum=number1; } else if(number2<=number1 &&number2<=number3) { minimum=number2; } else { minimum=number3; } printf("the minimum between %d , %d and %d is = %d\n",number1,number2,number3,minimum); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter