Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write Code In C Language Program 33. VWrite a micrcwavr carntrallr pragram thatw

ID: 3733710 • Letter: W

Question

Write Code In C Language

Program 33. VWrite a micrcwavr carntrallr pragram thatw takr as input thr tine ta caak something arnd thr pawerIrvrl (1 ta 1cl Assume that you havee ability to add a time delay so that every iteration of the loop takes 1 second vour program does not need to add the delay just assume that this coul d be added to your program!. ar pagrarn shuld decrrmernt the tinr evrry iterati af thr l and disly the remning tin. when the timer reaches half c1f the Daking tirne it shculd cut the power tD ½ and display the new power Irvrl. Whrn thr imer reaches zero, yaur program shuld rig thr bellhararter and display a messg surh as "Your faad is rral [Hint: use ator loo with an if statemnt.] Sample ouput idoesn't have to be identical). Enter eaok ing tite : Enter pouer leuel108)80 ino roneining 1 50c ino ronaining : 9 sac ine renaining: 8 sec ie renaining 7 eec ine reneining eec Pouer level is now * Tise renaining 5 eee Tine reneining 4 sec ine reneining 3 csc ino roneining 2 sac ino ronaining1 sac our food is done

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

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote