Ask Question
4 November, 07:52

Alguém me ajuda nesse algoritmo?

usar visualg

ler 10 valores e escrever quantos desses valores lidos são negativos

+5
Answers (1)
  1. 4 November, 10:09
    0
    First we must import the package import java. util.*;

    we create our scanner and we declare our variables and array

    We create a for cycle, and inside the for the If sentence to evaluate every number then we print our negative and positive numbers.

    numbers[10]

    nega

    posi

    Scanner num = new Scanner (System. in);

    int numbers[] = new int[10];

    int nega = 0;

    int posi = 0;

    for (int i=0; i<=9; i++)

    {

    System. out. print ("Enter the number " + (i+1) + ":");

    numbers[i] = num. nextInt ();

    if (numbers[i]<0) {

    nega++;

    }

    else

    {

    posi++;

    }

    System. out. println ("Negative numbers are: " + nega);

    System. out. println ("Positive numbers are: " + posi);

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Alguém me ajuda nesse algoritmo? usar visualg ler 10 valores e escrever quantos desses valores lidos são negativos ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers