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
jeka94
3 years ago
5

Write an if/else statement that compares the variable age with 65, adds 1 to the variable seniorCitizens if age is greater than

or equal to 65, and adds 1 to the variable nonSeniors otherwise.
Computers and Technology
1 answer:
Oduvanchick [21]3 years ago
6 0

if age >= 65:

seniorCitizens = seniorCitizens + 1

else:

nonSeniors = nonSeniors + 1

You might be interested in
g Write a program that prompts the user for an integer n between 1 and 100. If the number is outside the range, it prints an err
grin007 [14]

Answer:

The cpp program is given below.

#include<iostream>

#include<iomanip>

using namespace std;

int main() {

   

   // variables declared

   int n;

   int sum=0;

   float avg;

   

   do

   {

       // user input taken for number    

       cout<< "Enter a number between 1 and 100 (inclusive): ";

       cin>>n;

       

       if(n<1 || n>100)

           cout<<" Number is out of range. Enter valid number."<<endl;

       

   }while(n<1 || n>100);

   

   cout<<" "<<endl;

   

   // printing even numbers between num and 50  

   for(int num=1; num<=n; num++)

   {

       sum = sum + num;

   }

   

   avg = sum/n;

   

   // displaying sum and average

   cout<<"Sum of numbers between 1 and "<<n<<" is "<<sum<<endl;

   cout<<"Average of numbers between 1 and "<<n<<" is ";

   printf("%.2f", avg);

   

       return 0;

}

OUTPUT

Enter a number between 1 and 100 (inclusive): 123

Number is out of range. Enter valid number.

Enter a number between 1 and 100 (inclusive): 56

 

Sum of numbers between 1 and 56 is 1596

Average of numbers between 1 and 56 is 28.00

Explanation:

The program is explained below.

1. Two integer variables are declared to hold the number, n, and to hold the sum of numbers from 1 to n, sum. The variable sum is initialized to 0.

2. One float variable, avg, is declared to hold average of numbers from 1 to n.

3. User input is taken for n inside do-while loop. The loop executes till user enters value between 1 and 100. Otherwise, error message is printed.

4. The for loop executes over variable num, which runs from 1 to user-entered value of n.

5. Inside for loop, all the values of num are added to sum.

sum = sum + num;

6. Outside for loop, average is computed and stored in avg.

avg = sum/n;

7. The average is printed with two numbers after decimal using the following code.

printf("%.2f", avg);

8. The program ends with return statement.

9. All the code is written inside main() and no classes are involved.

3 0
3 years ago
Which type of photoreceptor is best able to process bright light and color?
Scilla [17]
Cone cells, or cones, are one of three types of photoreceptor cells in the retina of mammalian eyes. They are responsible for color vision and function best in relatively bright light, as opposed to rod cells, which work better in dim light.
4 0
3 years ago
Different methods of developing useful information from large data bases are dealt with under
oee [108]

Answer:

The answer to this question is option "d".

Explanation:

In this question, the answer is data mining. Because Data mining is a technique that finds a piece of new information in a lot of the data. In the data mining collecting information from data is hopefully both new and useful. Data mining help us to discover new patterns and relationship in data to help make better decisions. It is used everywhere like Television and radio, Banking, Retail, and business. That's why data mining is useful.

4 0
3 years ago
7. Glaciers have two types of deposition. Define them below:
Zielflug [23.3K]
<span>The Glacial deposition is the settling of sediments left behind by a moving glacier. As glaciers move over the land, they pick up sediments and rocks. The mixture of unsorted sediment deposits carried by the glacier is called glacial till. Piles of till deposited along the edges of past glaciers are called moraines.</span>
5 0
3 years ago
A monitor is a type of? CPU input memory output
aleksklad [387]

Answer:

Un monitor es un periférico de salida en el que la computadora muestra las acciones y ejecuciones que se realizan él.

Explanation:

:D

5 0
3 years ago
Other questions:
  • The _______________ layer of the TCP/IP protocol suite is responsible for making sure that what leaves one end of the network ar
    9·1 answer
  • Can someone pls explain this question??
    7·1 answer
  • Write a programme to find the sum of first three cube number?
    7·1 answer
  • )What is proceduralabstraction, and why is it important inComputer Science
    14·1 answer
  • Don is visiting digital stores and searching the internet to learn about high-definition DVD players before he buys one. This is
    8·1 answer
  • Why team goals should be broken into shon-term, medium-term, and long-term goals
    8·2 answers
  • I have tried many times to find a gaming setup for $4k. I have tried many websites but they are not working for my liking. Any o
    15·1 answer
  • 8. What do you believe: should husbands make decisions for their wives.
    5·1 answer
  • In which of the following stages of the development process is a team MOST likely to interview a potential user of an app?
    6·1 answer
  • What type of element addresses the recovery of critical information technology (it) assets, including systems, applications, dat
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!