Skip to content

isp-cluj/isp-lab-2-2023

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exercises Lab 2

Exercise 1

Generate a random number between 10 and 100 and populate an array of that size with random integers. Find the maximum and minimum values in the array.

Exercise 2

Write a program that reads two integers n and m from the keyboard, where n is less than m. The program should generate all prime numbers between n and m, inclusive. Then, it should compute the product of all the prime numbers and display the result.

Exercise 3

Write a program that takes an integer n as input and returns the sum of all positive integers from 1 to n. The program should use recursion to compute the sum.

Exercise 4

Implement an application that allows the user to search and find all the strings in a list that contain a specific substring. First, the user is asked to input all the strings, on one line, separated by comma (e.g. apples,computer,bread,tea,car). Next, the user is asked to input the substring to search for. The program should then display all the strings in the list that contain the specified substring.

Exercise 5

Write a program that reads in a list of integers from the user, on one line, separated by commas. The program should then find and display the largest even number and the smallest odd number in the list, along with their respective positions. If there are no even or odd numbers in the list, the program should display a message saying so.

Exercise 6

Write a game where the computer generates a random word (from a dictionary) and the user has to guess the word by inputting one letter at a time. After every guess, the program tells the user whether the letter is in the word or not and if it is in what position is the letter and display currently guessed letters and their position. At the end of the game, the program should display the word and the number of tries needed to guess the word.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages