a guest Jan 17th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Problem 1.  Declare Variables
  2. Declare five variables choosing for each of them the most appropriate of the types byte, short, int, long to represent the following values: 52130, -115, 4825932, 97, -10000.
  3. Choose a large enough type for each number to ensure it will fit in it. Try to compile the code.
  5. Problem 2.  Float or Double?
  6. Which of the following values can be assigned to a variable of type float and which to a variable of type double: 34.567839023, 12.345, 8923.1234857, 3456.091?
  7. Write a program to assign the numbers in variables and print them to ensure no precision is lost.
  9. Problem 3.  Quotes in Strings
  10. Declare two string variables and assign them with following value: The "use" of quotations causes difficulties.
  11. Do the above in two different ways - with and without using quoted strings.
  12. Print the variables to ensure that their value was correctly defined.
  14. Problem 4.  Exchange Variable Values
  15. Declare two integer variables a and b and assign them with 5 and 10 and after that exchange their values by using some programming logic.
  16. Print the variable values
  18. Problem 5.  Divide by 7 and 5
  19. Write a Boolean expression that checks for given integer if it can be divided (without remainder) by 7 and 5 at the same time.
  21. Problem 6.  Sum of 3 Numbers
  22. Write a program that reads 3 real numbers from the console and prints their sum.
  24. Problem 7.  Numbers from 1 to n
  25. Write a program that reads an integer number n from the console and prints all the numbers in the interval [1..n], each on a single line.
  27. Problem 8. The Biggest of 3 Numbers
  28. Write a program that read 3 numbers and finds the biggest of three numbers.
  30. Problem 9.  Numbers Not Divisible by 3 and 7
  31. Write a program that enters from the console a positive integer n and prints all the numbers from 1 to n not divisible by 3 or 7, on a single line, separated by a space.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!