Question

Write a program that reads k integers and displays their sum. Write a program that reads...

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)

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

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:

Add a comment
Know the answer?
Add Answer to:
Write a program that reads k integers and displays their sum. Write a program that reads...
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
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
ADVERTISEMENT