.Net is a frame work it is a software in this we are execute 64+ languages like C#.net,vb.net,Asp.net etc.Now a days every company develop projects through ms.net.So,The top MNC companies concentrate only on ms.net and in the interview purpose asking more on ms.net.so we definitely know the ms.net so we are placed what are the frequently asked questions and impressed answers.Friends don't blindly follow the answers for questions first know the topic after that you are ready/prepare your answers for the questions and perform that answers in every interview.First i tension i understand the topic but i can't perform interview what i prepare, i think one day why i lose my interview i know the all answers on that day i find out the reason because i am not saying my answer in my proper understand manner.After that i am not repeated that mistake now i get the good job.So friends so many also having these problem so you want full description about any topic you are seen previous articles and you want questions follow this article.All the best for your Interview.
Logical Programs
logical thinking |
13.Write a Console Program for following Pattern?
1 2 3 4 51 2 3 4
1 2 3
1 2
1
static void main(string args[])
{
for(int i=5;i>=1;i--)
{
for(int j=1;j<=i;j++)
{
console.write(j+"");
}
console.WriteLine();
}
Console.ReadLine();
}
14.Write a Console Program for following Pattern?
5 4 3 2 15 4 3 2
5 4 3
5 4
5
static void main(string args[])
{
for(int i=1;i<=5;i++)
{
for(int j=5;j>=i;j--)
{
console.write(j+"");
}
console.WriteLine();
}
Console.ReadLine();
}
15.Write a Console Program for following Pattern?
1 2 3 4 52 3 4 5
3 4 5
4 5
5
static void main(string args[])
{
int r=0,k=5;
for(int i=1;i<=5;i++)
{
for(int j=r+1;j<=k;j++)
{
console.write(j+"");
}
r++;
console.WriteLine();
}
Console.ReadLine();
}
16.Write a Console Program for following Pattern?
5 4 3 2 14 3 2 1
3 2 1
2 1
1
static void main(string args[])
{
int r=0,k=1;
for(int i=1;i<=5;i++)
{
for(int j=5-r;j>=k;j--)
{
console.write(j+"");
}
r++;
console.WriteLine();
}
Console.ReadLine();
}
17.Write a Console Program for following Pattern?
54 5
3 4 5
2 3 4 5
1 2 3 4 5
static void main(string args[])
{
int r=0,k=5;
for(int i=1;i<=5;i++)
{
for(int j=5-r;j<=k;j++)
{
console.write(j+"");
}
r++;
console.WriteLine();
}
Console.ReadLine();
}
18.Write a Console Program for following Pattern?
12 3
4 5 6
7 8 9 10
static void Main(String args[])
{
int k=1;
for(int i=1;i<=4;i++)
{
for(int j=1;j<=i;j++)
{
Console.Write(k+"");
k++;
}
Console.WriteLine("");
}
console.ReadLine();
}
19.Write a console program to display sum of given range?
static void Main(String args[]){
Console.WriteLine("Enter u r range");
int n=int.Parse(Console.ReadLine());
int sum=0;
for(int i=1;i<=n;i++)
sum=sum+i;
Console.WriteLine("sum is:"+sum);
Console.ReadLine();
}
20.Factorial of a given number?
static void Main(String args[]){
Console.WriteLine("Enter u r number");
int n=int.Parse(Console.ReadLine());
int fact=1;
for(int i=n;i>=1;i--)
fact=fact*i;
Console.WriteLine("factorial is:"+fact);
Console.ReadLine();
}
21.Write a console program for swappping of two numbers?
static void Main(String args[]){
Console.WriteLine("Enter i value");
int i=int.Parse(Console.ReadLine());
Console.WriteLine("Enter j value");
int j=int.Parse(Console.ReadLine());
int temp;
temp=i;
i=j;
j=temp;
Console.WriteLine("i value is:"+i);
Console.WriteLine("j value is:"+j);
Console.ReadLine();
}
22.Check whether the given number is even or odd?
static void Main(String args[]){
Console.WriteLine("Enter u r number");
int n=int.Parse(Console.ReadLine());
if(n%2==0)
{
Console.WriteLine("It is even number");
}
else
{
Console.WriteLine("It is odd number");
}
Console.ReadLine();
}
23.Write a console program for Fibonacci Series?
static void Main(String args[]){
Console.WriteLine("Enter u r number");
int n=int.Parse(Console.ReadLine());
int a=0,b=1,c=0;
while(a<=n)
{
c=a+b;
a=b;
b=c;
}
Console.readLine();
}
24.Write a Console Program for following Pattern?
10 9 8 76 5 4
3 2
1
static void Main(string[] args)
{
int k=10;
for(i=4;i>=1;i--)
{
for (j = 1; j <= i; j++)
{
Console.Write(k+" ");
k--;
}
Console.WriteLine("");
}
Console.ReadLine();
}
25.Write a Console Program for following Pattern?
12 3
4 5 6
7 8 9 10
11 12 13 14 15
static void Main(string[] args)
{
int k=1;
for(i=1;i<=5;i++)
{
for (j = 1; j <= i; j++)
{
Console.Write(k+" ");
k++;
}
Console.WriteLine("");
}
Console.ReadLine();
}
26. Write a Console Program for following Pattern?
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
static void Main(string[] args)
{
int i,j=5,k,x,m=1;
for(i=1;i<=5;i++)
{
for (k=1;k<=j;k++)
{
Console.Write(" ");
}
for(x=1;x<=i;x++)
{
Console.Write(m);
Console.Write(" ");
m++;
}
}
Console.WriteLine(" ");
j=j-1;
Console.ReadLine();
}
Friends You Like My Post Please Share To Your Friends Through Facebook,Google+,Twitter etc
2 3
4 5 6
7 8 9 10
11 12 13 14 15
static void Main(string[] args)
{
int i,j=5,k,x,m=1;
for(i=1;i<=5;i++)
{
for (k=1;k<=j;k++)
{
Console.Write(" ");
}
for(x=1;x<=i;x++)
{
Console.Write(m);
Console.Write(" ");
m++;
}
}
Console.WriteLine(" ");
j=j-1;
Console.ReadLine();
}
Friends You Like My Post Please Share To Your Friends Through Facebook,Google+,Twitter etc
0 comments:
Post a Comment