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
Neko [114]
3 years ago
9

Write a program which promptsuser to enter an integer value. Using while loop print the valuesfrom

Computers and Technology
1 answer:
tino4ka555 [31]3 years ago
6 0

Answer:Following is the c++ code for the problem:

#include <iostream>

using namespace std;

int main() {

   int number;

   cout<<"Enter the number"<<endl;

   cin>>number;

   int i=0,c=0,odd[500];

   while(i<=number)//loop for printing the numbers form 0 to number.

   {

       cout<<i<<" ";

       if(i%2!=0)// storing in the odd array if the number is odd.

       {

           odd[c++]=i;//storing odd numbers..

       }

       i++;

   }

   cout<<endl;

   i=0;

   cout<<"The odd numbers are "<<endl;

   while(i<c)//loop to print the odd numbers.

   {

       cout<<odd[i]<<" ";

       i++;

   }

   cout<<endl<<"The prime numbers are "<<endl;

   i=0;

   int sum=0;

   

   while(i<c)//loop to print the prime numbers..

   {

       int div=2;

       while(div<odd[i])

       {

           if(odd[i]%div==0)

           break;

           div++;

       }

       if(div==odd[i])

      {

           cout<<odd[i]<<" ";

           sum+=odd[i];//updating the sum..

      }

       i++;

   }

   cout<<endl<<"The sum of odd prime numbers is "<<sum<<endl;//printing the sum..

return 0;

}

Output :

Enter the number

49

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49  

The odd numbers are  

1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49  

The prime numbers are  

3 5 7 11 13 17 19 23 29 31 37 41 43 47  

The sum of odd prime numbers is 326 .

Explanation:

First I have printed the values from 0 to n and i have taken an array to store odd numbers.After that i have printed the odd values.And after that i have printed prime numbers among the odd numbers and their sum. These all operations are done using while loop.

You might be interested in
In a ____ environment, you can change directories using the cd command. For example, to change to a directory named MyClasses, y
GrogVix [38]
DOS, is your answer
7 0
2 years ago
Guess the output of this code:print( (3**2)//2 )
V125BC [204]

Answer:

Assuming that's in python, the answer would be 4

Explanation:

The ** operator is for raising a number to a power.

The // operator returns the number of times the right number can fit into the left (i.e round division).

So the answer would be three squared over two rounded down, or 4.

6 0
3 years ago
Which of the following is not a characteristic of data that can strongly affect cluster analysis?
german

Answer:

c. Skewness

Explanation:

Cluster analysis involves analyzing a set of object by grouping the set of objects in such a way that objects in the one group or cluster are more similar  to each other than to those in other groups or clusters. The characteristics of data that can strongly affect cluster analysis includes the size, sparseness, scale, etc.

3 0
3 years ago
. Which one of the following is not a JAD participant? 1. Managers 2. System analyst 3. Business development manager 4. Users
asambeis [7]

Answer: 3) Business development manager

Explanation:

 JAD stand for joint application development and it is the methodology which basically involved users and client in the development and designing of the application.

It is the process which basically accelerate the designing of the information technology system. JAD involve managers , system analyst and users to develop the dynamic solution. But it does not involve the business development manager as the JAD basically focused o the individual approach in the development.

6 0
3 years ago
PLEASE HURRY PLEASE HELP THIS CLASS ENDS TODAY AND I NEED HELP
Fofino [41]

Answer:

She could have given access to the computer to the techician

Explanation:

"as well as any special settings or configurations she thinks may be relevant." This might inculd any information to hack the computer

6 0
2 years ago
Other questions:
  • Which of the following is NOT correct concerning database design?
    13·1 answer
  • Which of the following is the fastest growing input technique​
    14·1 answer
  • 22. A<br> allows one computer to input data into another computer.
    6·1 answer
  • Write a method called removeInRange that accepts four parameters: an ArrayList of integers, an element value, a starting index,
    11·1 answer
  • Looking for friends, anyone up for it?
    12·2 answers
  • The Internet began when a large company wanted to sell products online.
    11·2 answers
  • Mississippi law codes state that bullying and cyberbullying are against the law. A court can decide to incur ___________________
    10·1 answer
  • Explain any two features of a computer​
    15·1 answer
  • It took her 9 more months but Marina has managed to save the full $725 plus more to cover fees to pay off the pay-day loan compa
    9·1 answer
  • ____must cooperate with each other to neutralize the global threat of information censorship. Select 3 options.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!