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;
- }
- public string EvenOrOdd( int Num)
- {
- if(num%2 ==0)
- retrun "evenNumber";
- else
- return "OddNumber"
- }
- 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);
- }
- }

appalanaidu vallePosted Aug 12, 2018, 8:39 PM
We don't required val variable declaration within for loop in Fibonacci, you can use the sum variable instead val new declaration.
appalanaidu vallePosted Aug 12, 2018, 8:26 PM
Below is the simplest prime number check method
appalanaidu vallePosted Aug 12, 2018, 8:24 PM
Static bool PrimeOrNot(int number) { bool isPrime = true; for (int i = 2; i < number; i++) { if (number % i == 0) { isPrime = false; break; } } return isPrime; }
Nadeem ShaikhPosted Jul 13, 2018, 5:28 AM
The last one "MulWithOutStarOperator" needs correction. int value should be out of for loop.
Guest UserPosted Feb 26, 2018, 1:14 AM
The Fibonacci program outputs: 0 1 2 3 5 8 instead of 0 1 1 2 3 5 8, it needs to be changed as: for (int i = 2; i < number; i++) { int value = f_0 + f_1; sum = f_0 + f_1; f_0 = f_1; f_1 = sum; Console.Write("{0} ", value); }
Sagar Pandurang KapPosted Jan 24, 2018, 5:07 AM
Amazing article.Very much helpful.Thanks a lott.