Write a program that reads k integers and displays their sum. Write a program that reads k values representing family income from the keyboard and place them into the array. Find the maximum income among these values. Count the families that make less than 10 percent of the maximum income. (JAVA)
ANSWER: Here I am giving you the code and output please like it.
CODE:
import java.util.*;
public class Main {
public static void main(String [] args)
{
Scanner sc = new Scanner(System.in);
int k;
System.out.println("Enter number of integers :
");
k=sc.nextInt();
int arr[] = new int[k];
System.out.println("Enter "+k+" incomes :");
for(int i=0;i<k;i++) {
arr[i]=sc.nextInt();
}
int max=arr[0];
for(int i=0;i<k;i++) {
if(arr[i]> max)
max=arr[i];
}
float tenpercentOfMAx = max*10/100;
System.out.println("Maximum income of the family:
"+max);
System.out.println("10% of maximum income:
"+tenpercentOfMAx);
int countless=0;
for(int i=0;i<k;i++)
{
if(arr[i]<tenpercentOfMAx)
countless++;
}
System.out.println("Number of families having less
than 10% income: "+countless);
}
}
OUTPUT:
Write a program that reads k integers and displays their sum. Write a program that reads...
Write a C program which reads sets of two integers and displays them and their sum. Continue readings sets of integers until their sum is zero, at which point terminate the program.
Task 1 : Write a Java program that prompts for and reads 10 integers from the user into an integer array of size 10, it then: - calculates the sum and average of positive numbers of the array and displays them. [Note: consider 0 as positive] Note: The program must display the message: "There are no positive values" if the array does not contain any positive value.
1. Write a program that reads a sequence of numbers from the keyboard, and displays the smallest number. The sequence has at least one number and is terminated by -999(-999 will not appear in the sequence other than as the end marker). 2. Write a program which requests an integer input n from the keyboard and computes the sum of square of k for all k from 1 to n(inclusive). use java
Write a program that reads two integer values. It then calculates and displays the sum and average of all values between them, Le. if the first value is vi and the second value is 2, then the program calculates and displays the sum and average of all values in the closed range Iv1,2 Your Program must satisfy the following constraints: A. make sure that v1 is less than 2 B. Use a function named getStats(that takes two integer yalues as...
Q1. CLO: (5 points) Write a java program that reads 10 words from the keyboard then place them in an array. Display the array elements in reverse order, and then count and print the number of times a word appears in that array. The user shall insert the word from the keyboard.
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...
Write a Java program that reads 10 integers from the keyboard and outputs all the pairs whose sum is 30 .
Max3.java: Write a program that reads 10 integers and displays top 3 records (i.e., the largest three elements). Please consider the extreme case when all integers are negative. For instance, by given -1, -2, …, -10, the display will be -1, -2, and -3.
Write a program that reads a set of integers and then finds and prints the sum of the even and odd integers
Write a Python program n_kids.py that reads the data from n_kids.txt, does some math, then displays the following: Total number of families: Total number of kids: Average number of kids per family: Maximum number of kids in a family: Minimum number of kids in a family: Extra credit (2 pts): write the above results to a different file (results.txt, not to the input file n_kids.txt) in addition to displaying them on the screen. Do not use built-in min and max...