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
Mariana [72]
2 years ago
11

1. Scrieţi un program care citeşte un număr natural n şi determină produsul cifrelor impare ale lui n. De exemplu, pentru n = 23

453, produsul este 45.
2.Scrieţi un algoritm care citeşte un număr natural n apoi n numere întregi. Să se determine câte din cele n numere întregi sunt strict pozitive şi divizibile cu 7. De exemplu, pentru n = 7 şi numerele -28, 21, 77, 15, -1, 42, -7 se va afişa 3 (acestea sunt 21, 77, 42).

3.Scrieţi un algoritm care citeşte un număr natural n şi calculează suma:
S = 1/(1*2) + 1/(2*3) + 1/(3*4) + … + 1/((n-1)*n)

4. Se citeşte un număr natural n. Să se calculeze suma divizorilor proprii ai lui n. De exemplu, pentru n=12, suma divizorilor proprii este 2+3+4+6=15

5. Se citeşte un număr natural n şi apoi n numere întregi. Să se calculeze şi să se afişeze suma numerelor naturale cuprinse între 10 şi 100. De exemplu, dacă n=5 şi apoi se citesc 30, –2, 14, 200, 122, atunci suma va fi 44 (adică 30 + 14).

6. Se citeşte un număr natural n de maximum 4 cifre. Câte cifre sunt în toate numerele de la 1 la n? De exemplu, pentru n=14 există 19 cifre, iar pentru n=9 sunt 9 cifre.

7. Se citesc numerele naturale n şi S, unde n poate fi 2, 3, 4 sau 5. Să se afişeze toate numerele de n cifre care au cifrele în ordine strict crescătoare, iar suma cifrelor este S. De exemplu, pentru n=2 şi S=10, se vor afişa 19, 28, 37, 46.

8. Se consideră şirul 1, 1, 2, 3, 5, 8, 13, ... în care primii doi termeni sunt 1, iar orice alt termen este obţinut din suma precedenţilor doi. Scrieţi un algoritm care citeşte un număr natural n şi afişează primii n termeni ai acestui şir. De exemplu, pentru n = 6, se vor afişa: 1, 1, 2, 3, 5, 8.

9. Să se scrie un algoritm care citeşte două numere naturale n1 şi n2 şi care afişează mesajul „da” dacă suma pătratelor cifrelor lui n1 este egală cu suma cifrelor lui n2 sau „nu” în caz contrar. De exemplu, pentru n1=232 şi n2=881 se va afişa „da”, iar pentru n1=45 şi n2=12 se va afişa „nu”.

10. Să se scrie un algoritm care citeşte un număr natural n şi afişează mesajul „da” dacă toate cifrele lui n sunt distincte, sau „nu” dacă n nu are toate cifrele distincte. De exemplu, pentru n=37645 se va afişa „da”, iar pentru 23414 se va afişa „nu”.
Computers and Technology
1 answer:
saveliy_v [14]2 years ago
3 0

Answer:

1.  

num1 = input("Enter the value of n")  

n = int(num1)  

def calc(n):  

Lst = []  

while n > 0:  

remainder = n % 10  

Lst.append(remainder)  

quotient = int(n / 10)  

n = quotient  

i = len(Lst) - 1  

sum = 1  

for i in range(0, len(Lst)):  

if(i % 2 != 0):  

sum *=Lst[i];  

else:  

continue  

print(sum)  

return(0)  

\ r2

num=input("Enter the value of n")

arr=[12,-12,13,15,-34,-35,35,42]

def div7positive():

  sum = 0

  m = 0

  i = 0

  while m <= 7:

      if(arr[i]>=0 and arr[i]%7 == 0):

          sum +=arr[i]

      i = i + 1

      m += 1

       

   

  print("sum of number divisible by 7 and positive is", +sum);

div7positive()

\ r

\ r3.Write an algorithm that reads a natural number n and calculates the sum:

\ rS = 1 / (1 * 2) + 1 / (2 * 3) + 1 / (3 * 4) +… + 1 / ((n-1) * n)

\ r

num=input("Enter the value of n")

def sumseries():

  sum = 0

  m= 0

  while m <= 7:

      sum +=1/((int(num)-1)*int(num))

      m += 1

  print("sum of series is", +sum)

sumseries()

\ R4. Read a natural number n. Calculate the sum of its own divisors n. For example, for n = 12, the sum of its own divisors is 2 + 3 + 4 + 6 = 15

num=input("Enter the value of n")

def sumdivisors():

  sum = 0

  m= 2

  while m <= int(num):

      if int(num) % m == 0:

          sum += m

      m += 1

  print("sum of divisors is", +sum)

sumdivisors()\ r

\ R5. We read a natural number n and then whole numbers. Calculate and display the sum of the natural numbers between 10 and 100. For example, if n = 5 and then read 30, –2, 14, 200, 122, then the sum will be 44 (that is, 30 + 14).

\ r

Lst = []  

num=input("Enter the value of n")

i = 0

while i<= int(num):

  num1=input("Enter the element of array")

  Lst.append(int(num1));

  i += 1

def numbet0and100():

  sum = 0

  m= 0

  while m <= int(num):

      if Lst[m] <= 100 or Lst[m] >=0:

          sum += Lst[m]

      m += 1

  print("sum of numbers between 0 and 100 is", +sum)

numbet0and100()

\ R6. A natural number n of maximum 4 digits is read. How many digits are in all numbers from 1 to n? For example, for n = 14 there are 19 digits, and for n = 9 there are 9 digits.

\ r

num = input("Enter the value of n")

n = int(num)

print(“sum as required is:” (n -9) + n)  

 

\ R7. Read the natural numbers n and S, where n can be 2, 3, 4 or 5. Show all the numbers of n digits that have the numbers in strictly ascending order, and the sum of the digits is S. For example, for n = 2 and S = 10, 19, 28, 37, 46 will be displayed.

num = input("Enter the value of n")

n = int(num)

Lst = []

def calc(n):

  i = 1

  total = pow(10,n)

  while i <= total:

      j = i

      while j > 0:

          remainder = j % 10  

          Lst.append(remainder)

          quotient = int(j / 10)

          if quotient > 0:

              j = quotient

          else:

              length = len(Lst) - 1

              sum = 0

              while length >= 0:

                  sum += Lst[length]

                  length = length - 1

              if sum == pow(10,n):

                  print(j)

              k = len(Lst)

              del Lst[0:k]

      i = i + 1

  return(0)

calc(n)

\ r

\ R8. We consider the row 1, 1, 2, 3, 5, 8, 13, ... in which the first two terms are 1, and any other term is obtained from the sum of the preceding two. Write an algorithm that reads a natural number n and displays the first n terms of this string. For example, for n = 6, 1, 1, 2, 3, 5, 8 will be displayed.

\ r

nterm = int(input("What number of terms do you want?"))

a, b = 0, 1

totalcount = 0

if nterm <= 0:

 print("Please input a positive number")

elif nterm == 1:

 print("Fibonacci number upto which",nterm,":")

 print(a)

else:

 print("Fibonacci series:")

 print(nterm)

 while totalcount < nterm:

     print(a)

     nth = a + b

     a = b

     b = nth

     totalcount += 1

 

\ 9. Write an algorithm that reads two natural numbers n1 and n2 and displays the message "yes" if the sum of the squares of the digits of n1 is equal to the sum of the numbers of n2 or "no" otherwise. For example, for n1 = 232 and n2 = 881, "yes" will be displayed, and for n1 = 45 and n2 = 12, "no" will be displayed.

num1 = input("Enter the value of n")

num3 = input("Enter the value of n")

n = int(num1)

num2 = int(num3)

def calc(n):

  Lst = []

  while n > 0:

      remainder = n % 10  

      Lst.append(remainder)

      quotient = int(n / 10)

      n = quotient

       

  i = len(Lst) - 1

  sum = 0

  while i >= 0:

      sum += Lst[i]* Lst[i]

      i = i - 1

  return(sum)

def calc1(num2):

  Lst = []

  while num2 > 0:

      remainder = num2 % 10  

      Lst.append(remainder)

      quotient = int(num2 / 10)

      num2 = quotient

       

  i = len(Lst) - 1

  sum = 0

  while i >= 0:

      sum = Lst[i] + Lst[i]

      i = i - 1

  return(sum)

a = calc(n)

b = calc1(num2)

if a == b:

  print("yes")

else:

  print("No")

\ r

\ R10. Write an algorithm that reads a natural number n and displays the message "yes" if all of its n numbers are distinct, or "no" if n does not have all the distinct digits. For example, for n = 37645 it will display "yes" and for 23414 it will show "no".

\ r

num1 = input("Enter the value of n")

n = int(num1)

def calc(n):

  Lst = []

  while n > 0:

      remainder = n % 10  

      Lst.append(remainder)

      print( remainder)

      quotient = int(n / 10)

      n = quotient

       

  flag = 1

  for i in range(0, len(Lst)):

      for j in range(i+1, len(Lst)):    

          if Lst[i] == Lst[j]:    

              flag = 0

              break

           

  if flag == 1:

      print("YES")

  else:

      print("NO")

  return(0)

Explanation:

Please check answer.  

You might be interested in
Find the name of the professor with the maximum percentage of students that failed his course.
aleksandrvk [35]

The minimum score needed to make an A is 89.

<h3>What is the z-score?</h3>

A Z Score, also known as the Standard Score, is a calculation used to determine how many standard deviations a raw score is below or above the population mean. Simply said, the Z Score informs you of a value's relationship to the mean and the distance a data point is from the mean.

Since the grades of his students were normally distributed, we would apply the formula for normal distribution which is expressed as

z = (x - µ)/σ

Where

x = grades of his students.

µ = mean grade

σ = standard deviation

From the information given,

µ = 74

σ = 10

The professor has informed us that 6.3 percent of his students received A's. The p-value for the minimum score is 1 - 0.063 = 0.937. The z value of 0.937 is 1.53.

1.53 = (x - 74)/10

1.53 × 10 = x - 74

15.3 = x - 74

x = 15.3 + 74

x = 89.3

Therefore, the minimum score needed to make an A is 89.

The complete question is given below:-

A professor at a local community college noted that the grades of his students were normally distributed with a mean of 74 and a standard deviation of 10. The professor has informed us that 6.3 percent of his students received A's while only 2.5 percent of his students failed the course and received F's. What is the minimum score needed to make an A?

To know more about the z- score, follow

brainly.com/question/25638875

#SPJ4

3 0
1 year ago
Ano ang bunga ng pagsunod sa tamang konsiyensiya?
gladu [14]

Answer:

A.

Explanation:

mapalaganap ang kabutihan

8 0
2 years ago
Read 2 more answers
Which access control principle specifies that no unnecessary access to data exists by regulating members so they can perform onl
sdas [7]
Least privilege is the data access principle that ensures to unnecessary access to data exists by regulation members so that can perform only minimum data manipulation necessary. The principle of least privilege or as called as POLP is the run-through of controlling access to the minimal level that will permit normal functioning. The norm of least privilege interprets to giving people the lowermost level of user right that they can have and still do their jobs. The principle is also functional to things other than people as well as programs and processes. It is created in the US department of defense in the 1970’s and aimed to limit the potential damage of any security breach either accidental or malicious. 
5 0
2 years ago
Is windows CUI operating system??<br><br><br>What is the main purpose of folder ????<br><br><br>​
Likurg_2 [28]
Answer: yes and main purpose of folder can help in storing and organizing files and data in the computer.

Hope this helped!
8 0
2 years ago
Explain what 10CLS program does and the write the output​
ludmilkaskok [199]
(CLS)


This text is being printed via the PRINT command."
On the next line, I'll use CLS, which will clear everything I just printed, so you won't even see the preceding text."
Also, you can't give CLS a line to PRINT; it won't actually do anything"
(CLS)
Finally, on line 80, I
3 0
2 years ago
Other questions:
  • When an architect designs a building, what visual design elements could be used to help capture a viewer’s attention? A) The use
    5·2 answers
  • The purpose of the ________ element is used to configure the main content of a web page document.
    5·1 answer
  • A(n ____ with a drop down menu provides consistency in function and appearance making it easy for users to learn and work with t
    7·1 answer
  • By default, a word document generally displays in ____ view.
    9·1 answer
  • jason works for a restaurant that serves only organic local produced what trend is this business following?
    6·2 answers
  • Keyshia wants to add movement to her PowerPoint presentation. Which tab should she use to complete this task
    15·2 answers
  • What are the functions of super computer?<br> ​
    7·2 answers
  • In 3-5 sentences describe to me in detail how you can make a change and better our online community. What are steps would you ta
    8·2 answers
  • An epic games service is unavailable at the moment
    8·1 answer
  • // This pseudocode is intended to describe
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!