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
larisa86 [58]
3 years ago
9

Ask the user to enter a number n >= 1. There after the user will enter n-1 distinct integers between 1 and n. Thus, the enter

ed numbers contain all numbers between 1 and n except one. Output the missing number. You are not allowed to use lists. You are also not allowed to use dictionaries or any programming concept more advanced that a loop. The numbers entered can be in any order.
Computers and Technology
1 answer:
snow_tiger [21]3 years ago
3 0

Answer:

Code below

Explanation:

n = int(input('Please enter n: '))#take input n

print('please enter the numbers')#print enter the numbers

total = 0 #intially take total as 0

original_total = 1 #intially take original_total=1

for i in range(2, n+1): #take the range 2 to n+1

total += int(input('Please enter a number: ')) # add total and enter the number

original_total += i

missing = original_total - total #you got missing number original_total - total

print('The missing number is: ' + str(missing)) # print missing number in the given data

You might be interested in
You notice that lately your computer has been running slow. When you open up your web browser, you get endless pop-up ads to the
Vlad [161]

Answer:

Spyware

Explanation:

The reason why you noticed your computer has been running slow is because of spyware, which is considered to be very bad to get on your computer. When a user opens his/her web browser, the user receives ads that are misleading to the user, which fools the user of thinking it's something real and not a scam. Not only that, the user also receives pop-up ads that can, as mentioned, trick the user to think that it's real and not fake. Finally, the user's search results will be manipulated. In conclusion, spyware is, in fact, the main cause of the scenario.

4 0
2 years ago
How long will the plant have been dead when 87.5 percent of its C-14 has become N-14?
nikdorinn [45]

Answer:

50% - one half life — 5,730 years

25% — two half lifes — 11,460 years

12.5% — three half lifes — 17,190 years

6.25% — four half lifes — 22,920 years

3.125% — five half lifes — 28,650 years

Explanation:

8 0
1 year ago
Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicatin
lyudmila [28]

Answer:

Following is the program in C language :

#include <stdio.h> // header file

#define n 5 //  macro

int main() main function

{

   int a[n],k1; // variable and array declaration

   printf("Enter the element:\n");

   for(k1=0;k1<n;++k1) //iterating the loop

   {

       scanf("%d",&a[k1]);//Read the values by user

   }

   printf("Output in Reverse Order:\n");

   for(k1=n-1;k1>=0;--k1)//iterating the loop

   {

   printf(" %d ",a[k1]); //Display the values

   }

   return 0;

}

Output:

Enter the element:

4

3

45

67

89

Output in Reverse Order: 89 67 45 3 4

Explanation:

Following is the description of the program

  • Define a macro "n" with value 5 after the header file.
  • Declared an array "a" and defined the size of that array by macro i.e "n".
  • Read the value by the user by using scanf statement in the array "a"
  • Finally In the last for loop display the values of array "a" by space.

7 0
3 years ago
in python Write a program that prompts the user to enter a hex character and displays its corresponding decimal integer python
Archy [21]

Answer:

Here is some that I know. The code is below:

#accepting input hex_num=input() #checking if it is a number if(hex_num>='0' and hex_num<='9'):     #printing that number     print(hex_num) #checking

Explanation:

I hope this helps

8 0
2 years ago
Q2
rosijanka [135]

Answer:

Computer is a electronic device which give us accurate result in a short preodical of time

6 0
2 years ago
Read 2 more answers
Other questions:
  • 48. What is another word for processor?
    7·1 answer
  • Solve the recurrence relation.<br> S(1)=1<br> S(n)= S(n-1)+(2n-1) for n&gt;=2
    13·1 answer
  • _____ are independent and not associated with the marketing efforts of any particular company or brand.​
    9·1 answer
  • Write four overloaded methods called randomize. Each method will return a random number based on the parameters that it receives
    5·2 answers
  • Kyle returns to work the next day and he would like to continue working on the document from yesterday. What should Kyle do?
    7·1 answer
  • _____ provides the best video resolution. *<br><br> VGA<br> HDMI<br> USB<br> DVI
    7·1 answer
  • When proofreading, you should do all of the following except _____.
    14·1 answer
  • Calculate the time complexity for the following function in terms of Big O notation. Explain your answer.
    13·1 answer
  • The RGB value below produces a shade of purple. What does the number 175
    15·2 answers
  • if we try to use tail-recursive rules to implement non-tail-recursive rules, it will normally result in rules that are
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!