Question

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

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

#include<stdio.h>

int main()

{

int int1,int2,int3,int4;

double d1,d2;

float f1,f2;

printf("\nEnter value of 4 integers :");

scanf("%d %d %d %d",&int1,&int2,&int3,&int4);

printf("\nEnter two float values :");

scanf("%f %f",&f1,&f2);

printf("\nEnter two double value:");

scanf("%lf %lf",&d1,&d2);

printf("\nThe output is: %d\t%d\t%d\t%d\t%.2f\t%.2f\t%.2lf\t%.2lf",int1,int2,int2,int4,f1,f2,d1,d2);

}

CppDroid project_feb07d.cpp Navigator Editor 1 #include<stdio.h> 2 int main() int int1, int2, int3, int4; double d1, d2; floaCppDroid terminal Stopped Enter_value of 4 integers :3 5 2 6 Enter two float values :2.45 6.7 Enter two double value:2.335 8.

Please upvote thanks...

Add a comment
Know the answer?
Add Answer to:
Write a program that reads 2 doubles, 2 float, and 4 integers and prints them four...
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
  • C programming! Write a program that reads integers until 0 and prints the sum of values...

    C programming! Write a program that reads integers until 0 and prints the sum of values on odd positions minus the sum of values on even positions. Let ?1, ?2, … , ??, 0 be the input sequence. Then the program prints the value of ?1 − ?2 + ?3 − ?4 + ⋯ ??. The input is a sequence of integers that always contains at least 0 and the output will be a single number. For example, for input...

  • I want a program can read in three integers then prints out their sum and product...

    I want a program can read in three integers then prints out their sum and product and average for my input,it should have one or more lines of numbers that have been typed in by the user. Each line is to have exactly three real numbers.I would like to sue in.nextDouble() to read a number and after reading there doubles. how do i discard rest of spaces? for my output it should have for each line,the numbers that had been...

  • 1. Write a python program that reads a file and prints the letters in increasing order...

    1. Write a python program that reads a file and prints the letters in increasing order of frequency. Your program should convert entire input to lower case and only counts letters a-z. Special characters or spaces should not be counted. Each letter and it's occurrences should be listed on a separate line. 2. Test and verify your program and it's output. ---Please provide a code and a screenshot of the code and output. Thank you. ----

  • Python Programming Write a program that reads the dimension of a rectangle and prints its area....

    Python Programming Write a program that reads the dimension of a rectangle and prints its area. The program must handle errors such invalid input. If it encounters an error, it should ask the user to reenter the input. Sample run: Enter height:abc abc is not a vaid input. Try again. Enter height:10 Enter width:hello hello is not a vaid input. Try again. Enter width:world world is not a vaid input. Try again. Enter width:xyz xyz is not a vaid input....

  • JAVA. Write a program that reads in a series of positive integers and prints out the...

    JAVA. Write a program that reads in a series of positive integers and prints out the maximum value entered. The user will indicate they are finished entering numbers by entering zero or a negative integer.

  • Problem Definition Write a program called process_ages that reads in an array of up to 10...

    Problem Definition Write a program called process_ages that reads in an array of up to 10 integers representing peoples ages in years and calculates and prints the maximum age and the minimum age and the average age. Your program should stop reading when either the 10th number is entered or the user enters -1. If the user enters any other negative number or a value above 150, they should be warned and prompted again for a valid age. You should...

  • Write a Java program that reads four integers and prints "two pairs" if the input consists...

    Write a Java program that reads four integers and prints "two pairs" if the input consists of two matching pairs (in some order) and "not two pairs" otherwise. For example, 1 2 2 1 two pairs 1 2 2 3 not two pairs 2 2 2 2 two pairs

  • Write a program that reads a list of integers in the range (0 – 49) and prints out the numbers that does not repeat twice

    IN PYTHONWrite a program that reads a list of integers in the range (0 – 49) and prints out the numbers that does not repeat twice.The first input of the program is the number of integers contained in this list, followed by the integers contained in the list. Print the numbers in in ascending order.Case 1:INPUT: 5 2 2 3 3 1OUTPUT:1Case 2:INPUT:6 1 2 1 2 2 2OUTPUT:2Case 3:INPUT:4 3 2 1 2OUTPUT: 1 3343 2 1 213

  • Problem 1: Write a program that reads a positive float number and displays the previous and...

    Problem 1: Write a program that reads a positive float number and displays the previous and next integers. Sample Run: Enter a float: 3.5 The previous and next integers are 3 and 4. Problem 2: Write a program that reads two integers and displays their sum, difference, product, and the result of their division. Sample Run: Enter two integers: 8 5 Sum: 8, Difference: 3, Product: 40, Division: 1.6 Problem 3: Write a program that reads a three-digit integer from...

  • This is a Java program Write a program that reads an unspecified number of integers, determines...

    This is a Java program Write a program that reads an unspecified number of integers, determines home many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number to 2 decimal places. System.out.println(countPositive); System.out.println(countNegative); System.out.println(total); System.out.printf("%.2f",total * 1.0 / count); Assume inputs are always integer [-912985158, 912985158] and ends with 0. Input 1 2 -1 3...

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
Active Questions
ADVERTISEMENT