1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Ray Of Light [21]
2 years ago
12

Create a basic program that accomplishes the following requirements: Allows the user to input 2 number , a starting number x and

ending number y Implements a while loop that counts from x (start) to y(end). Inside the loop , print to the screen rather the current number is even or odd If the number is even , multiply by the number by 3 and print the results to the screen. If the number is odd , add 10 and print the results to the screen. Use at least 1 increment or decrement operator.
Computers and Technology
1 answer:
katrin [286]2 years ago
6 0

Answer:

Explanation:

The following program is written in Java. It asks the user for the two inputs and then uses those inputs in a for loop. The loop goes through each number checking to see if it is even or odd. If it is even it prints out Even: and the number after multiplying it by 3. If it is odd it prints out Odd: and the number after adding 10 to it. The output can be seen in the attached picture below.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter number 1: ");

       int num1 = in.nextInt();

       System.out.println("Enter number 2:");

       int num2 = in.nextInt();

       for (int x = num1; x <= num2; x++) {

           if ((x % 2) == 0) {

               System.out.println("Even: " + (x*3));

           } else {

               System.out.println("Odd: " + (x+10));

           }

       }

   }  

}

You might be interested in
Look act the picture
VLD [36.1K]

Answer:

the answer is b

Explanation:

3 0
3 years ago
Spreadshet formula to add totals​
frozen [14]

Answer:

=SUM(Range value)

like =SUM(A1:A7) or =SUM(A1:H1)

Explanation:

We need to make use of the SUM function, and then we need to mention the cells or range value that references a series of cells row-wise or column-wise. Like a range value of A1:A7 means A1,A2,A3,A4,A5,A6,A7 and the range value of A1:H1 means A1, B1,C1,D1,E1,F1,G1,H1. And similarly, you can represent various cells depending upon the code you come up it, and finally, you need to sum them all using the SUM function.

7 0
3 years ago
Which of the following is a property of TCP?
Serggg [28]

Answer:

o best effort

Explanation:

beacuse it i think do

3 0
3 years ago
Letter Frequency Write a function that will take a string and return a count of each letter in the string. For example, "my dog
Nostrana [21]

Answer:

Check the explanation

Explanation:

Code to copy:

// ConsoleApplication7.cpp : Defines the entry point for the console application.

//

#include "stdafx.h"

#include <iostream>

#include <cstring>

#include <string>

using namespace std;

int * letterFrequency(char s[]);

int main()

{

  int *freq_letters;

  char *s = new char[100];

  freq_letters = new int[26];

  //To read the input string in order to find the frequency of each letter

  cout << "Enter a string: ";

  cin.getline(s, ' ');

  //call the function to find the occurrence of each alphabet

  freq_letters = letterFrequency(s);

  //Display the count

  cout << "Letter Frequency " << endl;

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

  {

      //Constriant to check if the letter appeared at least once in the string and so printing the frequency of its occurence

      if (freq_letters[i] != 0)

      cout << " " << static_cast<char>(i + 'a') << " " << freq_letters[i] << endl;

  }

  system("pause");

  return 0;

}

//Define the function to find occurrence of each letter in the input string

int * letterFrequency(char s[])

{

  int *occurrence_array;

//to store the output of occurrences for each alphabet

  occurrence_array = new int[26];

// to store the count of occurrence for each letter temporarily

  int letter_count;

  // for loop to check the occurrence for all 26 alphabets

 

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

  {

      letter_count = 0;

      for (int j = 0; j < strlen(s); j++)

      {

          /*comparing the ascii values of each alphabet with every character from the string by converting it to lower case i.e. case insensitive*/

          if (int('a') + i == int(tolower(s[j])))

              letter_count++;

      }

      occurrence_array[i] = letter_count;//To store the count calculated for each alphabet

  }

  return occurrence_array;

}

The following below code screenshot and output shows that when the string is entered, the output will shows each lettercount irrespective of whether the letter is in capitals or small and does not count non-letter characters (i.e spaces, punctuations etc.)

6 0
3 years ago
Two friends can share 100 songs from their Bluetooth enabled mobile devices
Umnica [9.8K]

Answer:

A

Explanation:

If they are connected via bluetooth, you can share unlimited amounts of anything.

6 0
3 years ago
Other questions:
  • . Once a vulnerability has been identified by Nessus, where would you check for more information regarding the identified vulner
    15·1 answer
  • Respecting culture in the workplace means understanding that
    5·2 answers
  • According to the video, what education and experience do employers look for in Reporters and Correspondents? Check all that appl
    10·2 answers
  • A location in memory used for storing data and given a name in a computer program is called a because the data in the location c
    14·1 answer
  • Suppose you are given a bag containing n unbiased coins. You are told that n − 1 of these coins are normal, with heads on one si
    7·1 answer
  • Which of the following BEST describes an extranet?
    13·1 answer
  • Identify the benefit of modeling to communicate a solution.
    10·1 answer
  • Ano ang humahati ng globo ng equdor
    8·1 answer
  • What time is it NOW??
    11·2 answers
  • How to beat level 50 in give up robot 2
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!