Write Code In C Language Program 33. VWrite a micrcwavr carntrallr pragram thatw
ID: 3733710 • Letter: W
Question
Write Code In C Language
Explanation / Answer
#include <stdio.h>
int main(void) { // program for MIcroWave contol
int time,power,i;
printf("****** MIcroWave Control ********** ");
printf("enter the time ");
scanf("%d",&time); // reading the input time
printf("enter the power 1-100 ");
scanf("%d",&power); // reading the input power
printf(" ");
for(i=time;i>=0;i--){ // given assumption is 1 sec for each iteration of for loop
if(i==0){ // check for end of the time
printf(" ");
break;
} //end if of checking end of time
if(i== (time/2) ){ // check for half of the time
printf(" ");
printf("power level is now %d ",power/2);
printf(" ");
}//end if of checking half time
printf("time remaining is : %d ",i); // printing the time remaining
} // end for loop
printf("Your food is ready ");
return 0;
}//end main
input:
10 // time
80 // power
output:
****** MIcroWave Control **********
enter the time
enter the power 1-100
time remaining is : 10
time remaining is : 9
time remaining is : 8
time remaining is : 7
time remaining is : 6
power level is now 40
time remaining is : 5
time remaining is : 4
time remaining is : 3
time remaining is : 2
time remaining is : 1
Your food is ready
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.