Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 4 Correct errors in program. (11 points in total): 1) (5 points) The following program is used to check if a given number is

image text in transcribed

Part 4 Correct errors in program. (11 points in total): 1) (5 points) The following program is used to check if a given number is the power of 2 using bitwise operator 1 include 2 define NUM BITS INT (8 sizeof (double)) 4 nt power2 (unsigned int x) int i, count - 0, result, shiftnum; - for (i - 0;i i result-shift num &&1i if (result) 12 13 14 15 16 17 18 19 20 21 22 int main) 23 24 25 26 27 28 29 30 count++ if (count % 2-1) printf ("YES") else print("NO") unsigned int num; printf("InEnter Number"); scanf("%d", num); this.power2 (num) return 0; Which line(s) is(are) incorrect And how to correct it(them)? Please write down your correction for that line (those lines) 2) (6 points) The following shell script is used to check if the numbers from command line are even or odd bin/bash count 4 for Snum in s@ 5 do if [ expr $num % 2 -- ] then echo Snum is an even number count expr $count+i 10 else echo Snum is an odd number 12 13 14 15 echo There are $count even numbers in total Ei Which line(s) is(are) incorrect? And how to correct it(them)? Please write down your correction for that line (those lines)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions