Question
1. Write a program that prompts the user to enter in characters, an equal sign, and an integer. The program then reads and discards all
1. Write a program that prompts the user to enter in characters, an equal sign, and an integer. The program then reads and discards all characters from standard input using getchar() until it encounters the "=". The program then reads the integer value that follows the "=" using scanf() and outputs the value back to the user. For example:
Enter some text, equal sign and an integer: The number = 16439 The integer you entered is: 16439
2. Write a program that prompts the user to enter two values of data type "double". Implement a function called print_doubles() that takes the two arguments of data type "double" and uses printf() to display both.
3. Write a program that prompts the user to enter in a character and an integer. Implement a function called repeat_character() that takes the two arguments (character and an integer) entered by the user and displays the character by duplicating it the integer number of times on the screen with a single space between the characters. For example:
Enter a character and a number: A 7 A A A A A A A
4. Write a program that prompts the user to enter in two "long" values. Implements a function called negative_count() that takes two arguments of data type "long" and returns an integer that is the number of arguments that were negative. The function main() then displays the result. For example:
Enter two integers of data type "long": -1264364007 -2012334695 Number of negative number entered 2
5. Write a program that prompts the user to enter in two integers. Implement a function called max_value() that takes two arguments that are pointers to two integers entered by the user. The function max_value() determines which of the two values is the largest and assigns the max value to both variables. The function main()then displays the values of both variables to demonstrate that they both contain the max value. For example:
Enter two integers: 23 57 Both values are now: 57 57
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started