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
Pepsi [2]
3 years ago
15

Write a Visual Logic program that prompts the user for a whole number, N, that is less than or equal 50

Computers and Technology
1 answer:
Bezzdna [24]3 years ago
8 0

Answer:

//program in C++(Visual studio).

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

// variable

int num;

cout<<"Enter a number greater than 1 and less than 51:";

// read input number

cin>>num;

// check input is in between 1-50

if(num<=1||num>50)

{

    cout<<"Invalid input!!"<<endl;

    // exit the program

    exit;

}

else

{

// sum variable

    int sum=0;

    // find sum of all odd numbers

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

    {

        if(a%2!=0)

        sum+=a;

    }

    // print sum

    cout<<"Sum of odd numbers from 1 to "<<num<<" is:"<<sum<<endl;

}

return 0;

}

Explanation:

Read a number from user and assign it to variable "num".If input number

is less than 1 or greater than 50 exit the program.otherwise find the sum

of all odd numbers from 1 to "num".Print the sum of odd numbers.

Output:

Enter a number greater than 1 and less than 51:-5                                                                          

Invalid input!!

Enter a number greater than 1 and less than 51:55                                                                          

Invalid input!!

Enter a number greater than 1 and less than 51:15                                                                          

Sum of odd numbers from 1 to 15 is:64

You might be interested in
What is the purpose behind the Three Phase Commit? It improves upon the two phased commit by requiring that locks be acquired at
Ray Of Light [21]
The answer is a) It improves upon the two-phased commit by requiring that locks be acquired at the start of a transaction.

Reason: The 3PC is an extension or you can say developed from 2PC that avoids blocking of an operation. It just ensures that first n sites have intended to commit a transaction that means it acquires commits or locks before the start of any transaction to avoid any blocking.

Option b) is wrong as it does not allow coordination, it just let all the other sites do their transaction if any other site is blocked, so no coordination is there between sites that they will wait till their coordinator is corrected.

Option c) is wrong as lock operations are shared between other connections as when their coordinator fails, the new coordinator agrees to the old coordinator that they had shared locks before and they can start their transaction.

Option d) is wrong as option a) is correct.

If you like the answer, please upvote.
4 0
3 years ago
You are finally at the stage of the software life cycle where you begin programming. What is this stage called?
nataly862011 [7]
You are finally at the stage of the software life cycle where you begin programming. What is this stage called?

development

5 0
3 years ago
Sheila is using a process of saving files to her desktop and then renaming them. She is
inessss [21]

Answer: D

Use the internet to search for a new app to rename the folder.​

Explanation:

Rename function is used to change the name of the file or directory i.e. from old_name to new_name without changing the content present in the file. This function takes name of the file as its argument. There are many alternatives to this in which Sheila can found out through the internet.

5 0
3 years ago
Read 2 more answers
Ethernet ensures that _____ on a shared network never interfere with each other and become unreadable.
Dmitry [639]

Answer:

Signals.

Explanation:

Encryption is a form of cryptography and typically involves the process of converting or encoding informations in plaintext into a code, known as a ciphertext. Once, an information or data has been encrypted it can only be accessed and deciphered by an authorized user.

Some examples of encryption algorithms are 3DES, AES, RC4, RC5, and RSA.

Ethernet ensures that signals on a shared network never interfere with each other and become unreadable through the use of encapsulation and standard encryption protocols.

In Computer Networking, encapsulation can be defined as the process of adding a header to a data unit received by a lower layer protocol from a higher layer protocol during data transmission. This ultimately implies that, the header (segment) of a higher layer protocol such as an application layer, is the data of a lower layer such as a transportation layer in the Transmission Control Protocol and Internet Protocol (TCP/IP).

The TCP/IP model comprises of four (4) layers;

1. Application layer: this is the fourth layer of the TCP/IP model. Here, the data unit is encapsulated into segments and sent to the transport layer.

2. Transport layer (layer 3): it receives the segment and encapsulates it into packets and sends to the internet layer.

3. Internet layer (layer 2): packets are encapsulated into frames.

4. Network layer (layer 1): frames are then converted into bits and sent across the network (LAN).

Hence, the data unit encapsulated inside a packet is known as segment, which is typically referred to as packet segmentation.

Additionally, these data, segments, packets, frames and bits transmitted across various layers are known as protocol data units (PDUs).

8 0
3 years ago
What is the best anime of all time?​
Blizzard [7]

(My opinion)  Naruto! (then Boruto is on it's way to becoming good)

but other people might say my hero academia or any of the dragon ball saga

4 0
3 years ago
Other questions:
  • Numeric data is stored in ___________ for direct processing.
    10·2 answers
  • Where is authorization management app on tablet?
    7·1 answer
  • Find the 65th percentile from the data. The data consist of class interval from 0-10, 10-20, 20-30, 30-40, 40-50, 50-60 and freq
    8·1 answer
  • Elizabeth types in the following search terms: "Adoption AND cats AND NOT Persians." what results will her search provide?
    12·2 answers
  • How many 16ths are in 3/8 of an inch
    12·1 answer
  • Write a function called first_last that takes a single parameter, seq, a sequence. first_last should return a tuple of length 2,wh
    14·1 answer
  • The IntList class contains code for an integer list class. Study it; notice that the only things you can do are: create a list o
    7·1 answer
  • What to do when you strip a screw
    10·2 answers
  • Does any one here play destiny on xbox one
    12·1 answer
  • Which search engine do you prefer? Why
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!