programming 2

Write a program that inputs a word representing a binary number (0s and 1s). First, your program should verify that it is indeed a binary number, that is, the number contains only 0s and 1s. if that is not the case, your program should print a message that the number is not a valid binary number. Then, your program should count how many 1s are in that word and output the count.

  1. 👍 0
  2. 👎 0
  3. 👁 296
  1. What part are you stuck on?

    1. 👍 0
    2. 👎 0
  2. 10001

    1. 👍 0
    2. 👎 0

Respond to this Question

First Name

Your Response

Similar Questions

  1. intro to computer programming

    Write a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount. Your program should use a

  2. java programming

    1. Time Calculator Write a program that asks the user to enter a number of seconds. • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the

  3. C++

    // Program: name of program // Author: your name // Date Written: date you began writing the program /* Abstract: Brief description of the program */ Include in-line comments in the body of your program. You can convert

  4. Programming concepts

    Develop a menu-driven program that inputs two numbers and, at the user’s option, finds their sum, difference, product, or quotient. top-down modular approach and pseudocode to design a suitable program to solve it. I am having

  1. java

    Write a java application that finds the smallest of several integers. Prompt the user for the number of integers that will be input, then prompt the user for that number of integers. Evaluate the integers to determine the smallest

  2. C++ programming computer

    I'm having some trouble trying to program these problems and putting them into the main function. Please help me by giving some advice or website that offer good information for me. The questions are below here: 1. Write a

  3. Oop programming

    Write a program that inputs (from the user) the number of hours worked and hourly pay rate for employees and outputs their total pay. The program should process an arbitrary number of employees; the user will terminate input by

  4. programming

    Ancient square root algorithm. The Babylonian algorithm to compute the square root of a number n is as follows: 1. Make a guess at the answer (you can pick n/2 as your initial guess). 2. Compute r = n / guess 3. Set guess = (guess

  1. gtuc

    1. WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND BREADTH=8CM. 2. CALCULATE THE PRICE OF AN ITEM COSTING 100 GHANA CEDIS AFTER A DISCOUNT OF 10% IS APPLIED TO IT. 3. WRITE A PROGRAM TO CALCULATE THE

  2. Computer (Programming with Python)

    Problem 1: Multiplication Drill Computers can perform calculations extremely quickly and accurately, but it's often handy to calculate with the computers we carry around inside our heads. Write a program to drill you in

  3. c programming

    a student designed a program to accept the age of an employee and then compute the employees retirement year and display the same in a statement on the screen required. a) write out the pseudo-code for the program above b) write

  4. C Programming

    Write a program that prompts the user to enter a temperature, followed by a letter representing Celsius (C) or Fahrenheit (F). Then prompt the user for the conversion type and print the results to the screen with one decimal

You can view more similar questions or ask a new question.