viniciusfreitasrj17 / test-algorithm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Test Algorithm

Install deps

npm install

Exercise 1 - Simple Calculator

Create a calculator that takes two numbers and an operator (+, -, *, /) and returns the result of the operation.

Exercise 2 - Prime Numbers

Write a function that checks whether a number is prime or not. Then create a program that prints the first 10 prime numbers.

Exercise 3 - Factorial

Write a function to calculate the factorial of a number. Next, create a program that allows the user to enter a number and displays the corresponding factorial.

Exercise 4 - Palindrome

Create a function that checks whether a word is a palindrome (that is, whether it reads the same backwards and forwards). The program must ask the user for a word and inform whether or not it is a palindrome.

Exercise 5 - Table

Create a program that receives a number from the user and displays the table of that number, from 1 to 10.

Exercise 6 - Vowel Counter

Create a function that counts the number of vowels in a string. The program should ask the user for a sentence and display how many vowels it has.

Exercise 7 - Grade Average

Create a program that takes a student's grades in three different subjects and calculates the average of the grades. Then display the calculated average.

Exercise 8 - Interest Calculation

Create a function that calculates the final value of an investment based on initial capital, interest rate, and investment time (in months). The program must prompt the user for these values and display the final value.

Run (npm run ex[number]). Example

npm run ex1

About


Languages

Language:TypeScript 100.0%