Write a function with one input parameter of type int. If this parameter is equa
ID: 3862644 • Letter: W
Question
Write a function with one input parameter of type int. If this parameter is equal to I, the function shall display Good morning! If the parameter is 2, display Good afternoon! If the parameter is anything else, display Input error. You must use switch in the body of the function. Test this function by calling it from main several limes Write a function that will take three input parameters of type float and display the one whose value is in between the other two (e g for parameters 3 0, -2.0, 1.5, display 1.5). Test this function by calling it several times from main with different parameters 3 Write a function that would act as a simple pseudorandom number generator the function shall take one number (unsigned long int x) in a sequence as input and produce the next number y (also unsigned long int) as output: y = 22695477-x + 1, modulo 2^32. Call this function five times in a loop and display the sequence generated Let the starting number in this sequence be 1000Explanation / Answer
#include<stdio.h>
#include<math.h>
void func1(int value)
{
switch(value)
{
case 1:
printf("Good morning! ");
break;
case 2:
printf("Good afternoon! ");
break;
default:
printf("Input error ");
break;
}
return;
}
2) void func2(float a,float b,float c)
{
if(a>b && b>c)
printf("%f ",b);
else if(b>a && a>c)
printf("%f ",a);
else
printf("%f ",c);
}
void func3(unsigned long int x)
{
unsigned long int number = 22695477;
unsigned long int y = (number * x + 1)%pow(2,32);
printf("%lu ",y);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.