Тут такое дело: люди читают книжки из компьютерной секции в Барнс анд Ноубл, нахватываются ключевых слов, запоминают синтаксис, шаблоны и стандартные рецепты. А программировать при этом не умеют и как устроен компьютер - не знают.
1. Write a program that prints the numbers from 1 to 100. But for multiples of 3 print “Fizz” instead of the number and for the multiples of 5 print “Buzz”. For numbers which are multiples of both 3 and 5 print “FizzBuzz”.
2. Write a function that checks if a given string is a palindrome. For example: "abcba" -> True, "abab" -> False, "aa" -> True, "a" -> True.
3. Write a function that takes a string and returns an unsigned integer represented by this string (in binary). For example, "1111" -> 15, "10101" -> 21, "1017" -> error (not binary). Bonus points for handling overflow. Extra bonus points for signed integers.
4. Write a program that takes an integer N and prints the Nth Fibonacci number (1, 1, 2, 3, 5, 8, 13, 21, 34, 55...).
no subject
Date: 2014-07-08 03:43 pm (UTC)1. Write a program that prints the numbers from 1 to 100.
But for multiples of 3 print “Fizz” instead of the number and for the multiples of 5 print “Buzz”.
For numbers which are multiples of both 3 and 5 print “FizzBuzz”.
2. Write a function that checks if a given string is a palindrome. For example: "abcba" -> True, "abab" -> False, "aa" -> True, "a" -> True.
3. Write a function that takes a string and returns an unsigned integer represented by this string (in binary). For example, "1111" -> 15, "10101" -> 21, "1017" -> error (not binary). Bonus points for handling overflow. Extra bonus points for signed integers.
4. Write a program that takes an integer N and prints the Nth Fibonacci number (1, 1, 2, 3, 5, 8, 13, 21, 34, 55...).