JS-Operators & Expressions.

Total Number of Questions: 8
 Add two Numbers.

You are provided with two numbers a and b. Your task is to add these two numbers.

Note: Complete the AddTwoNumbers function. No need to take any input.

Ans:-
const AddTwoNumbers = (a,b) => {
    return a+b;
};

 Find if the conditions are obeyed or not?

You are given two number first as a and second as b and check if both conditions (a<10 and a>b) are satisfied or not with the help of operators.

Note: Complete the Is_Valid function. No need to take any input.

Ans:-
const Is_Valid = (a,b) => {
    if(a < 10 && a > b){
        return 'true';
    }
    else{
        return 'false';
};

 Check the conditons.

You are given two numbers a and b You need to do the following checks:

  1. If both are divisible by 10 console true.
  2. If both are not divisible by 10 console false.
  3. If one of them only is divisible by 10 console true.

Note: Complete the Check function. No need to take any input.

Ans:-
const Check = (A, B) => 
    {
        if(A%10 == 0 && B%10 == 0){
            return 'true';
        }
        else if(A%10 == 0 || B%10 == 0){
            return 'true';
        }
        else{
            return 'false';
        }
};

 Find the first digit of a 4 digit number.

You are provided a four digit number n only. Your task is to print out the first digit of that number.

Note: Complete the First_Digit function. No need to take any input.

Ans:-
const First_Digit = (n) => {
    var a = n/1000;
    var b = parseInt(a);
    return b;
};

 Find the last digit of a 4 digit number.

You are provided a four digit number n only. Your task is to print out the last digit of that number.

Note: Complete the Last_Digit function. No need to take any input.

Ans:-
const Last_Digit = (n) => {
    var a = n%10;
    return a;
};

 Find the remainder.

You are provided with two numbers a and b where a as divisor and b as dividend.Your task is find the remainder.

Note: Complete the Find_the_remainder function. No need to take any input.

Ans:-
const Find_the_remainder = (a,b) => {
    return b%a;
};

 Multiply two Numbers.

You are provided with two numbers a and b Your task is to multiply these two numbers.

Note: Complete the Multiply_two_number function. No need to take any input.

Ans:-
const Multiply_two_number = (a,b) => {
    return a*b;
};

 Marks Calculator.

Shyam has got his marks in three subjects as a, b and c (out of 100).Write a program to calculate his total marks and his average.

Note: Complete the Sum and Avarage function. No need to take any input.

Ans:-
const Sum = (A, B, C) =>{
    return A+B+C;
};

const Average = (A, B, C) =>{
    return (A+B+C)/3;
};