Question: Given the C program in Figure 1, find the output of the program main.c 1 #include 2 3 void convert(int); 4 int convert2(int); 5
Given the C program in Figure 1, find the output of the program main.c 1 #include 2 3 void convert(int); 4 int convert2(int); 5 6 int main(void) { 7 int a=5; 8 10 11 12 13 14 15 int b; printf("Before convert: a-%d ",a); convert(a); printf("After convert: a-%d ",a); b-convert2(a); printf("After convert2: a=%d b=%d ",a,b); return 0; 16 } 17 18 19 void convert (int a){ a=2*a; 20 } 21 22 23 int convert2(int b){ int a; 24 a-4; 25 b=a*b; 26 return (b); 27 Figure 1. I- b. Complete the following table that shows the status of each LED after the program was executed: i. While the switch IS NOT PRESSED [6 marks] LED no. Status (Turn ON, Turn OFF or Blinking) 1 2 3 4 5 6 ii. While the switch IS PRESSED (continuously hold the press) LED no. Status (Turn ON, Turn OFF or Blinking) 1 2 3 4 5 6 Question 3 Figure 3a shows the Arduino board that integrated with 6 LEDs and 1 switch, while Figure 3b shows the executed C program which is simulated using Tinkercad. LED 3 LED 2 LED 1 DIGITAL (PWM-) O UNO ARDUINO IOREF RESET POWER Figure 3a 0+X*| ON ANALOG IN LED 4 LED 5 LED 6
Step by Step Solution
There are 3 Steps involved in it
There are some syntax errors in the provided C code Lets correct those errors and anal... View full answer
Get step-by-step solutions from verified subject matter experts
