├── README.md ├── apu.jpg ├── bubly.jpg ├── puja.jpg ├── sakib.jpg ├── purnima.jpg ├── index.html └── calc.ts /README.md: -------------------------------------------------------------------------------- 1 | # index -------------------------------------------------------------------------------- /apu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/index/main/apu.jpg -------------------------------------------------------------------------------- /bubly.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/index/main/bubly.jpg -------------------------------------------------------------------------------- /puja.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/index/main/puja.jpg -------------------------------------------------------------------------------- /sakib.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/index/main/sakib.jpg -------------------------------------------------------------------------------- /purnima.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asif-daffodil/index/main/purnima.jpg -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 9 | 10 | 11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /calc.ts: -------------------------------------------------------------------------------- 1 | // Define a function that takes two numbers and an operator, and returns the result. 2 | function calculate(num1: number, num2: number, operator: string): number { 3 | switch (operator) { 4 | case '+': 5 | return num1 + num2; 6 | case '-': 7 | return num1 - num2; 8 | case '*': 9 | return num1 * num2; 10 | case '/': 11 | if (num2 !== 0) { 12 | return num1 / num2; 13 | } else { 14 | throw new Error("Cannot divide by zero"); 15 | } 16 | default: 17 | throw new Error("Invalid operator"); 18 | } 19 | } 20 | 21 | // Example usage: 22 | const num1 = 10; 23 | const num2 = 5; 24 | const operator = '*'; 25 | 26 | try { 27 | const result = calculate(num1, num2, operator); 28 | console.log(`${num1} ${operator} ${num2} = ${result}`); 29 | } catch (error) { 30 | console.error(error.message); 31 | } 32 | --------------------------------------------------------------------------------