1. Write a conditional that assigns true (1) to the variable fever if the variab
ID: 3751005 • Letter: 1
Question
1. Write a conditional that assigns true (1) to the variable fever if the variable temperature is greater than 98.6
2.Assume that isIsosceles is an int variable, and that the variables isoCount,triangleCount, and polygonCount have all been declared and initialized. Write a statement that adds 1 to each of these count variables (isoCount,triangleCount, and polygonCount)if isIsosceles is 1.
3.Write a statement that toggles the value of onOffSwitch. That is, if onOffSwitch is false, its value is changed to true; if onOffSwitch is true, its value is changed to false.
(ALL IN C LANGUAGE)
Explanation / Answer
#include <stdio.h>
void feverDetect(void)
{
unsigned short fever = 0;
float temperature = 0;
printf("Answer for Question 1 ");
printf("Enter Value of temperature: ");
scanf("%f", &temperature);
if(temperature > 98.6) // Condition for question 1.
{
fever = 1;
}
else
{
fever = 0;
}
}
void isIsoscelesDetect(void)
{
int isIsosceles;
int isoCount = 0;
int triangleCount = 0;
int polygonCount = 0;
printf("Answer for Question 2 ");
printf("Enter Value of isIsosceles: ");
scanf("%d", &isIsosceles);
if(isIsosceles == 1) // Condition for question 2.
{
isoCount = isoCount + 1;
triangleCount = triangleCount + 1;
polygonCount = polygonCount + 1;
}
}
void toggleSwitch(void)
{
static unsigned short>
printf("Answer for Question 3 ");
^ 0x01; // Statement for question 3.
}
int main(void)
{
printf("C Programming Language Example ");
feverDetect();
isIsoscelesDetect();
toggleSwitch();
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.