use C language plz.
Posted: Wed Apr 27, 2022 3:10 pm
use C language plz.
Write a program to read a string of l’s and O’s. Then consider it a binary number and convert it to the its corresponding decimal value and output it. For example, if the input is 10000000, then the output is 128; if the input is 00000001, the output is 1. Your program should include i. a sub-function that returns the decimal value of the input string, and its prototype is int getDecimal(char str[]); ii.the main function that reads in a string, calls getDecimal() and prints the result to the screen. Below is a sample run of your program. You may assume that the string contains no more than 10 characters and that the user input is always legal. X O Console program output Please input a binary string: 0110001 The decimal value of the string is: 49 Press any key to continue. ..
Write a program to read a string of l’s and O’s. Then consider it a binary number and convert it to the its corresponding decimal value and output it. For example, if the input is 10000000, then the output is 128; if the input is 00000001, the output is 1. Your program should include i. a sub-function that returns the decimal value of the input string, and its prototype is int getDecimal(char str[]); ii.the main function that reads in a string, calls getDecimal() and prints the result to the screen. Below is a sample run of your program. You may assume that the string contains no more than 10 characters and that the user input is always legal. X O Console program output Please input a binary string: 0110001 The decimal value of the string is: 49 Press any key to continue. ..