use C language plz.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

use C language plz.

Post by answerhappygod »

use C language plz.
Use C Language Plz 1
Use C Language Plz 1 (203.33 KiB) Viewed 29 times
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. ..
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply