For all of the problems on InterviewBit, we do not require you to write a main function / Main class.
You are not required to read input, but instead use the arguments passed to your function. You are not required to print the desired values, but instead return the data as defined by the function signature.
Lets say you were given the problem of adding 2 number a and b.
Example: a : 2 b : 3 Output : 5
The code will go like this :
CPP
int add(int a, int b) { return a + b; }
C
int add(int a, int b) { return a + b; }
Python
class Solution: def add(a, b): return a + b
Java
public class Solution { public int add(int a, int b) { return a + b; } }
For all of the problems of Bash on InterviewBit, incase you have to take input, please take it from file named 'input' (without quotes). Print your final output to console.
Lets say you were given the problem of adding two numbers which are in the first line of the file named 'input'
Example: Input: 2 3 Output : 5
Bash
#!/bin/bash a=$(cat input| head -n 1 | awk '{print $1}') b=$(cat input| head -n 1 | awk '{print $2}') echo $((a+b))