Write a C program that prompts the user to enter a binary value, multiplies it by ten, then displays the result in binary. (“Binary” here means that the user communicates with the program in ones and zeros.) Your main function should
a) declare a char array,
b) call the readLn function to read from the keyboard
c) call a function to convert the input text string to an int
d) multiply the int by ten
e) call a function to convert the int to its corresponding binary text string,
f) call writeStr to display the resulting binary text string.
Code -
#include <stdio.h>
#include <math.h>
//read char array from keyboard
void readLn(char a[]){
printf("Enter binary number ");
scanf("%s",a);
}
//function to conver char array to string
int convertStringToInt(char a[]){
int x;
//sscanf is used to convert char array or string to integer
sscanf(a, "%d", &x);
return x;
}
//function to write output of bianry number multiply by 10
void writeStr(int binaryNum){
printf("\nBinary number x10 is %d",binaryNum);
}
//function to convert binary to decimal
int binaryToDeci( int num)
{
int deciNum = 0, i = 0, r;
while (num!=0)
{
r = num%10;
num /= 10;
deciNum += r*pow(2,i);
++i;
}
return deciNum;
}
//function to convert decimal to binary numer
int deciToBinary(int num)
{
int binaryNum = 0;
int r, i = 1;
while (num!=0)
{
r = num%2;
num /= 2;
binaryNum += r*i;
i *= 10;
}
return binaryNum;
}
int main()
{
//variable decalare
char a[10];
//read the input in array a
readLn(a);
//convert the string to int
int binaryNum = convertStringToInt(a);
//convert binary numbaer to integer
int decimalNum = binaryToDeci(binaryNum);
//multiply by decimal by 10
decimalNum = decimalNum * 10;
//convert decimal to binary number
binaryNum = deciToBinary(decimalNum);
//print the result multiply y 10
writeStr(binaryNum);
return 0;
}
Screenshots -

Write a C program that prompts the user to enter a binary value, multiplies it by...
IN C language Write a C program that prompts the user to enter a line of text on the keyboard then echoes the entire line. The program should continue echoing each line until the user responds to the prompt by not entering any text and hitting the return key. Your program should have two functions, writeStr andcreadLn, in addition to the main function. The text string itself should be stored in a char array in main. Both functions should operate...
Write a program that prompts the user to enter a binary string and displays the corresponding decimal integer value. For example, binary string ‘10001’ is 17 (1*24 +0*23 +0*22 +0*2 + 1 = 17) A sample run : Enter a binary: 10001 17 Enter second integer: 110 6 Use python.
I need to Write a test program that prompts the user to enter 10 double values into an array, calls a method to calculate the average of the numbers, and displays the average. Next, write a method that returns the lowest value in the array and display the lowest number. The program should then prompt the user to enter 10 integer values into an array, calculates the average, and displays the average. The program should have two overloaded methods to...
Write a program that prompts the user for a String value and a character value. The program should then find the last occurrence of the provided character in the provided String and display the corresponding index. If the character is not found in the String, display -1. For additional challenge, create a multi-class solution. The business class should consist of two instance varaibles to store the user provided values and one method to accomplish the given task. The tester class...
Program must be in Python 3.
Write a program that prompts the user to enter two strings and then displays a message indicating whether or not the first string starts with the second string. Your program must satisfy the following requirements. 1. Your program must include a function called myStartsWith that takes two string parameters. This function returns True if the rst string starts with the second string and returns False otherwise. 2. Your program must include a main function...
Write a program that prompts the user to input a string. The program then uses the function substr to remove all the vowels from the string. For example, if str=”There”, then after removing all the vowels, str=”Thr”. After removing all the vowels, output the string. Your program must contain a function to remove all the vowels and a function to determine whether a character is a vowel. #include <iostream> #include <string> using namespace std; void removeVowels(string& str); bool isVowel(char ch);...
Write a C program that prompts the user to enter a series of integers that represent a coded message. I have given you the decoder program so that you can see how it is written using array notation. Your assignment is to convert the code to a program that uses only pointers and pointer math. Your program must use pointer notation and pointer math (i.e. no array index notation other than in the declaration section, no arrays of pointers and...
1. Backward String Design a program that prompts the user to enter a string and then displays the string contents backward. For instance, if the user enters “gravity” the program should display “ytivar" -VB or Visual Studio. It must be turned into a GUI program. Make sure to write comments and include pseudocode. -Paste a screenshot of the pseudocode, the VB code, and of the program running into a PDF.
Please help with 3.12 and 3.14
Write a program that prompts the user to enter the length of the star and draw a star, as shown in Figure 3.5a. (Turtle: display a STOP_sign) write a program that displays a STOP sign, as shown in Figure 3.5b. The hexagon is in red and the text is in white. (Turtle: draw the Olympic symbol) write a program that prompts the user to enter the radius of the rings and draws an Olympic...
Write a C++ program that prompts the user with the following menu options: Erase-ArrayContent Count-Words Quit 1. For Erase-ArrayContent option, write complete code for the C++ function Erase described below. The prototype for Erase function is as follow: void Erase( int a[ ], int * N, int * Search-Element) The function Erase should remove all occurrences of Search-Element from the array al). Note that array a[ ] is loaded with integer numbers entered by the user through the keyboard. N...