Question

4. Write a  C program to ask user  to input a float number, then round it up to...

4. Write a  C program to ask user  to input a float number, then round it up to the second digit after decimal point and output it.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>
void main()
{
float n;
printf("\n\n Enter any floating point number: ");
scanf("%f",&n);
printf("After rounding the floating point number is %0.2f",n);
}

Screenshots:

Output:

DOSBox 0.74, Cpu speed: max 100% cycles, Frameskip 0, Program: TC File Edit Search Run Compile Debug Project Options F[1]= CHECK.C #include<stdio.h> void main() - O X Window Help =[+] float n; printf('n Enter anu floating point number: ; scanf('%'',&n); printf( After rounding the floating point number is 20.27,n); 8:1 SO 71 Heln FC Hel 2 Sau 3 One Altromler Make A MO

Enter any floating point number: 12.679 After rounding the floating point number is 12.68 Enter any floating point number: 12.655 After rounding the floating point number is 12.65 Enter any floating point number: 12.999 After rounding the floating point number is 13.00 Enter any floating point number: 88.99 After rounding the floating point number is 88.99 Enter any floating point number: 98.555 Af ter rounding the floating point number is 98.56 Enter any floating point number: 98.545 After rounding the floating point number is 98.54_

DOSBox 0.74, Cpu speed: max 100% cycles, Frameskip 0, Program: TC File Edit Search Run Compile Debug Project Options F[1]= CHECK.C #include<stdio.h> void main() - O X Window Help =[+] float n; printf('n Enter anu floating point number: ; scanf('%'',&n); printf( After rounding the floating point number is 20.27,n); 8:1 SO 71 Heln FC Hel 2 Sau 3 One Altromler Make A MO

We were unable to transcribe this image

Add a comment
Know the answer?
Add Answer to:
4. Write a  C program to ask user  to input a float number, then round it up to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • to ask user to input a float number, then round it up to the second digit...

    to ask user to input a float number, then round it up to the second digit 4. Write a C program after decimal point and output it. (6 points)

  • Write a program that asks the user to input a 4-digit integer and then prints the...

    Write a program that asks the user to input a 4-digit integer and then prints the integer in reverse. Your program needs to implement a function reverse that will take in as input the 4-digit number and print it out in reverse. Your code will consist of two files: main.s and reverse.s. Main.s will ask for the user input number and call the function reverse. For ARM/Data Structure needs to be able to run on Pi Reverse.s will take in...

  • Question 4 (3 mark) : Write a Java program to ask the user to input an...

    Question 4 (3 mark) : Write a Java program to ask the user to input an integer number from the keyboard. The output should indicate whether it is positive, zero, or negative, an even number or an odd number. REQUIREMENTS • Your code should ask user to input an integer number, then decide its sign and parity based on this input. • Your code should use if-else statement. Your code must work exactly as the specification and the output should...

  • Write a C program that counts the number of each digit entered by the user (Input...

    Write a C program that counts the number of each digit entered by the user (Input process should be ended using EOF character). You should use switch to compute the number of each digits. For each digit your program should print a line containing that number of adjacent asterisks. Sample Input1: 18218342850056D855599 Sample Outputi: 0** 3° 5*** 6° 7 g*** Sample Input: 77777445521056 Sample Output2: 0* 1 2° 3 45 S. 6° 8 9 Sample Output 3: Sample Input3: 782222231567799988001332092555...

  • Write a program that would ask the user to enter an input file name, and an...

    Write a program that would ask the user to enter an input file name, and an output file name. Then the program reads the content of the input file, and read the data in each line as a number (double). These numbers represent the temperatures degrees in Fahrenheit for each day. The program should convert the temperature degrees to Celsius and then writes the numbers to the output file, with the number of day added to the beginning of the...

  • Write a C++ Program Write a program that prompts the user to input a number. The...

    Write a C++ Program Write a program that prompts the user to input a number. The program should then output the number and a message saying whether the number is positive, negative, or zero. You must insert the following comments at the beginning of your program and write our commands in the middle: Write a C++ Program: 1 Name: Your Name ID: Your ID #include <iostream> using namespace std; din main YOUR CODE HERE

  • Write a complete C++ program to ask the user to enter 4 integers. The program must...

    Write a complete C++ program to ask the user to enter 4 integers. The program must use a function to find the smallest integer among them and print it on the screen. Typical output screen should be as following: Write a complete C++ program to ask the user to enter 4 integers. The program must use a functionto find the smallest integer among them and print it on the screen. Typical output screen should be as following: Note: the code...

  • Write a program that reads 2 doubles, 2 float, and 4 integers and prints them four...

    Write a program that reads 2 doubles, 2 float, and 4 integers and prints them four in a line separated by tabs or spaces. The user should be prompted for input with a suitable instruction and the output should line up to the right. The numerical output should also have a minimum width of 5 and a precision of 2 decimal places to the right of the decimal. In C programming

  • c programming Problem 2 Write a Hexadecimal to Decimal converter. Program will take an input (hexadecimal...

    c programming Problem 2 Write a Hexadecimal to Decimal converter. Program will take an input (hexadecimal number) from user and display its corresponding decimal number, as an output, on the screen. Moreover, after you're done with one conversion, ask for another input in an infinite loop fashion, link to online Hexadecimal to Decimal converter: https://www.binaryhexconverter.com/hex-to-decimal-converter 50 point

  • Write an interactive C++ program that asks a user to input the color code of a...

    Write an interactive C++ program that asks a user to input the color code of a resistor and determines its value and tolerance Tell the user how to input the color rings “Instructions” Tell the user to input the colors one after the other After the program receives the information it will display the resistance and tolerance Output an error message if the user enters an invalid color code (no garbage values should be displayed), and ask for another input...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT