Hi Friends this time I am sharing you a very simple basic programs that generally asked at the time of interview. I used to ask it sometimes very simple programs. We know that we can make it out that program but in interview time if you know how to do that then you can make it out very easily and make a face that you are thinking about it. But you know already. and write it after some moments. So just take a look before the interview.
Program 1: Return Vowel of Not. Solution.
- public bool CheckVowel(object sender,KeyEventArgs e)
- {
- if(e.KeyCode ==Keys.A||e.KeyCode ==Keys.E||e.KeyCode ==Keys.I||e.KeyCode ==Keys.O||e.KeyCode ==Keys.U)
- {
- return true;
- }
- else
- return false;
- }
Program 2: Even or Odd Solution.
- public string EvenOrOdd( int Num)
- {
- if(num%2 ==0)
- retrun "evenNumber";
- else
- return "OddNumber"
- }
Program 3: Prime Number Solution.
- public string PrimeOrNot(int num)
- {
- int i = 0;
- for (i = 3; i < num; i++)
- {
- if (num % i == 0)
- {
- Console.WriteLine("{0} is not a prime number", num);
- break;
- }
- }
- if (i == num)
- {
- Console.Writeline("{0} is a prime Number", num);
- }
- }
Program 4: Fibonacci Series Solution.
- public void FibonacciSeries(int number)
- {
- int f_0 = 0;
- int f_1 = 1;
- int sum;
- Console.Write("{0} {1} ", f_0, f_1);
- for (int i = 2; i < number; i++)
- {
- sum = f_0 + f_1;
- f_0 = f_1;
- f_1 = sum;
- int value = f_0 + f_1;
- Console.Write("{0} ", value);
- }
- }
Program 5: Factorial Solution.
- public int Factorial(int number)
- {
- int value = 1;
- for (int i = 1; i <= number; i++)
- {
- value = value * i;
- }
- return value;
- }
Program 6: Permutation (nPr) Solution.
Reference Solution 5
- public double Permutation(int n, int r)
- {
- double nPr = Factorial(n) / Factorial(n - r);
- return nPr;
- }
Program 7: Combination (nCr) Solution.
Reference Solution 5
- public double Combination(int n , int r)
- {
- double nCr = Factorial(n)/Factorial(r)*(Factorial(n-r);
- return nCr;
- }
Program 8: Add two numbers without using the plus operator Solution.
- public int Add (int x , int y )
- {
- return x-(-y);
- }
Program 9: Multiply two numbers without usering * operator Solution.
- public int MulWithOutStarOperator( int x ,int y)
- {
- for(int z= 1 ; z<=y ; z++)
- {
- int value = value +x;
- }
- return value;
- }