Skip to content

fariha28345/Basic_Java_Problems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic_Java_Problems

Problems

  1. Suppose, a=10 and b=20. Now swap the value using a temp variable. Output: a=20, b=10

  2. Suppose, a=10 and b=20. Now swap the value without a temp variable. Output: a=20, b=10

  3. Suppose a=15.5276. print the value upto 2 decimal point. Output: a=15.52

  4. Write a program that will find your key is found in the given array using binary search method
    numbers=[1,6,9,3,5,4,7]
    key=5

  5. Write a program that will find your key is found in the given array using linear search method
    numbers=[1,6,9,3,5,4,7]
    key=5

  6. Generate random 10 integer numbers in an array and print out all the numbers from array and also print the max and min number from the array

  7. Write a program that will breakdown the amount and count notes for any given amount. Here is the notes in the given array:
    notes=[1000,500,200,100,50,20,10,5,2,1]

    Example 1: User input: 575
    Output:
    500 1
    50 1
    20 1
    5 1
    Example 2: User input: 2148
    Output:
    1000 2
    100 1
    20 2
    5 1
    2 1
    1 1

  8. Print the prime numbers of 2 to 100

  9. Write a program that will give following output:
    1
    12
    123
    1234
    12345

  10. Write a program that will give following output:
    12345
    2345
    345
    45
    5

  11. Find out the second largest element of the given array
    numbers=[5,3,9,7,4,1,8]

  12. Write a program that will shuffle (values will randomly change their position) from the given array
    numbers=[1,2,3,4,5,6,7,8,9,0]
    random output: 3 5 0 1 7 9 6 4 2 8

  13. Take any number as input and print the reverse of the number
    input: 12345
    output: 54321

  14. Find out the duplicate numbers in the given array and in which position they are found.
    numbers=[1,2,3,1,2,4,5,6,4]

    Output:
    Duplicate value: 1 at index 3
    Duplicate value: 2 at index 4
    Duplicate value: 4 at index 8

  15. Count number of words, number of characters without spaces, number of vowels and consonant from the given string:
    "I live in Bangladesh"
    Output:
    Number of words: 4
    Number of chars without spaces: 17
    Number of vowels: 7
    Number of consonant: 10

  16. Encrypt word: ROADTOSDET [when A=F]
    Output: WTFIYTXIJY

  17. Check if the given string is palindrome or not. Palindrome means after reversing a string, it will be same.
    Input: Civic
    Output: true
    Input: One
    Output: false

  18. Write a program that will take integer numbers as user input continuously and print the sum of numbers until user input q from the keyboard. When user input q, program will be quit. If user inputs another character, then the program will ask to input the number again.

  19. Extract the OTP from the SMS. "Your one time password is 246148. Don't share this code with anyone \r\nBvwt3f8js2S"

  20. A core i 7 laptop price is 85000 tk and a gaming mouse price is 2500 tk. If I buy the laptop and 1 piece mouse, what will be my total cost after giving 15% discount? [Extract the digits from the paragraph and calculate the price]

Doc File of Code with Output

https://docs.google.com/document/d/1S4WcnKofLlx3tVXSRYBcOdzNiI4oYgPzOlXE1QrZdlI/edit?usp=sharing

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages