Posts

Showing posts with the label Error Debugging

checkGreatestFactor

 Error Debugging   checkGreatestFactor   Problem Statement  You are required to fix all logical errors in the given Code. You can Compile & Run to check the compilation/execution status of the program. You can use  printf   to debug your code. The submitted code should be logically/syntactically correct and pass all testcases. Do not write the  main()  function as it is not required.  Code Approach  For this question, you will need to correct the given implementation. We do not expect you to modify the approach or incorporate any additional library methods The function  checkGreatestFactor(int num) accepts an integer num as an input and is supposed to return the highest factor that is less than num. It uses another function calculateFactor(int inputNumber) for calculating the factors of a number. The function checkGreatestFactor looks fine but gives a compilation error. Your task is to fix the program so that it passes...

printTable

 Error Debugging   printTable   Problem Statement  You are required to fix all logical errors in the given Code. You can Compile & Run to check the compilation/execution status of the program. You can use printf   to debug your code. The submitted code should be logically/syntactically correct and pass all testcases. Do not write the main() function as it is not required.  Code Approach  For this question, you will need to correct the given implementation. We do not expect you to modify the approach or incorporate any additional library methods The function printTable(int num) is supposed to print the first ten multiples of the multiplication table of the input number num. The function compiles fine but fails to return the desired results for some cases. Your task is to fix the program so that it passes all the test cases.  Test Cases   Test Case 1   Input  6  Expected Return Value  6 12 18 24 30 ...