Question: This code is in Basic C Language. I'm having a problem with the code please help. Objective: Working with functions In this lab, you need

This code is in Basic C Language. I'm having a problem with the code please help.This code is in Basic C Language. I'm having a problem with

Objective: Working with functions In this lab, you need to create a C program that asks the user to input a positive integer number and displays the sum of the digits of the input number and checks whether the number is a prime or not. Your program should have the following 3 functions (procedures) 1) int readNum () to take a valid number (greater than O) from the user. This function has no input and returns a valid integer number entered by the user. (2 marks) sum of digits of the input number. (3 marks) integer variable as an input and returns a Boolean variable as an output. (3 marks) 2) int sumDigits (int num) takes an integer number as an input and returns the 3) bool isPrime (int num) to check if a number is a prime. This function has one A Sample interaction is as follow Please enter a positive integer number: -365 Invalid Input Please enter a positive integer number: 1356 Sum of digits of 1356 is 15 1356 is NOT a prime number Please enter a positive integer number: 17 Sum of digits of 17 is 9. 17 is a prime number. Hint: The main function will call the functions as follow int main ()[ int num- readNum ); int sum - sumDigits (num); bool prime - isPrime (num); //Display messages to the user return 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!