subject

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 = 23453, 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”.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 08:30
On the loan worksheet in cell c9 enter pmt function to calculate the monthly payment for the altamonte springs 2018 facilities loan. ensure that the function returns a positive value and set the reference to cells b5 and b6 as absolute references.
Answers: 2
question
Computers and Technology, 22.06.2019 10:00
Businesses allocate resources for their best and most productive uses. the more a resource, the more costly it will be. a manufacturer that requires scarce and costly resources is likely to charge for its products.
Answers: 2
question
Computers and Technology, 22.06.2019 12:10
1. package newton’s method for approximating square roots (case study 3.6) in a function named newton. this function expects the input number as an argument and returns the estimate of its square root. the script should also include a main function that allows the user to compute square roots of inputs until she presses the enter/return key. 2. convert newton’s method for approximating square roots in project 1 to a recursive function named newton. (hint: the estimate of the square root should be passed as a second argument to the function.) 3. elena complains that the recursive newton function in project 2 includes an extra argument for the estimate. the function’s users should not have to provide this value, which is always the same, when they call this function. modify the definition of the function so that it uses a keyword parameter with the appropriate default value for this argument, and call the function without a second argument to demonstrate that it solves this problem. 4. restructure newton’s method (case study 3.6) by decomposing it into three cooperating functions. the newton function can use either the recursive strategy of project 1 or the iterative strategy of case study 3.6. the task of testing for the limit is assigned to a function named limitreached, whereas the task of computing a new approximation is assigned to a function named improveestimate. each function expects the relevant arguments and returns an appropriate value. 5. a list is sorted in ascending order if it is empty or each item except the last one is less than or equal to its successor. define a predicate issorted that expects a list as an argument and returns true if the list is sorted, or returns false otherwise. (hint: for a list of length 2 or greater, loop through the list and compare pairs of items, from left to right, and return false if the first item in a pair is greater.)
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
Many everyday occurrences can be represented as a binary bit. for example, a door is open or closed, the stove is on or off, and the fog is asleep or awake. could relationships be represented as a binary value? give example.
Answers: 1
You know the right answer?
1. scrieţi un program care citeşte un număr natural n şi determină produsul cifrelor impare ale lui...
Questions
question
Mathematics, 22.11.2019 00:31
question
Chemistry, 22.11.2019 00:31
Questions on the website: 13722360