Friday, September 16, 2011

Print 5 number


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Fiveno
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[5];
            int i;

            for (i = 0; i < 5; i++)
            {
                Console.WriteLine("Enter number");
                a[i] = Convert.ToInt32(Console.ReadLine());
            }
            for (i = 0; i < 5; i++)
            {
                Console.WriteLine(a[i]);
            }
            Console.ReadLine();
        }
    }
}

Number Search


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Numsearch
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[5];
            int i,n;

            for (i = 0; i < 5; i++)
            {
                Console.WriteLine("Enter number");
                a[i] = Convert.ToInt32(Console.ReadLine());
            }

            Console.WriteLine("Enter number to search");
            n = Convert.ToInt32(Console.ReadLine());

            for (i = 0; i < 5; i++)
            {
                if (n == a[i])                
                {
                    Console.WriteLine("Number is found at "+i);
                }
                else
                {
                    Console.WriteLine("Number is not found");                
                }
            }
            Console.ReadLine();                      
       }
    }
}

What will u do to win the all-new Jetta Volkswagen

Tweet to take part in the #anything4jetta contest

What will u do to win the all-new Jetta



All the new Jetta can be yours, with the #anything4jetta contest.
All you need to do is :

Step 1 Simply follow @volkswagenindia on twitter
Step 2 Tweet what you will do to win the all-new Jetta using #anythings4jetta


You can aslo send an audio, vedio or call-in tweet
The quirkiest, wittiest tweet wins the all-new Jetta


Now The Question is ow far will you go to win one ?



Sorting


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Sorting1
{
    class Program
    {
        static void Main(string[] args)
        {
           
            int[] arr = new int[5];
            int a, b, temp = 0;
            Console.WriteLine("Enter Number");
       
            for (int i = 0; i < 5; i++)
            {
                arr[i] = Convert.ToInt32(Console.ReadLine());
            }
            Console.WriteLine();
            for (a = 0; a < 4; a++)
            {
                for (b = a+1; b < 5; b++)
                {
                    if (arr[a] > arr[b])
                    {
                        temp = arr[a];
                        arr[a] = arr[b];
                        arr[b] = temp;
                    }
                }
            }
            for(a = 0; a < 5; a++)
            {
                Console.WriteLine(arr[a]);
            }
            Console.ReadLine();
        }
    }
}

3 Student Marksheet


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace arrmarksheet
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] roll = new int[3];
            int[] m1 = new int[3];
            int[] m2= new int[3];
            int[] m3 = new int[3];
            int[] tot = new int[3];
            float[] per = new float[3];
            string[] name = new string[3];
            int i;

            for (i = 0; i < 3; i++)
            {
                Console.WriteLine("Enter Roll Number");
                roll[i] = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Enter Name");
                name[i] = Console.ReadLine();
                Console.WriteLine("Enter Marks1");
                m1[i] = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Enter Marks2");
                m2[i] = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Enter Marks3");
                m3[i] = Convert.ToInt32(Console.ReadLine());
            }
         
            for (i = 0; i < 3; i++)
            {
                 tot[i] = m1[i] + m2[i] + m3[i];
                 Console.WriteLine("total" + tot[i]);
                 per[i] = tot[i]/ 0.3f;
                 Console.WriteLine("percentage" + per[i]);
            }
            Console.ReadLine();
        }
    }
}

Search


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Numsearch
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = new int[5];
            int i,n;

            for (i = 0; i < 5; i++)
            {
                Console.WriteLine("Enter number");
                a[i] = Convert.ToInt32(Console.ReadLine());
            }

            Console.WriteLine("Enter number to search");
            n = Convert.ToInt32(Console.ReadLine());

            for (i = 0; i < 5; i++)
            {
                if (n == a[i])                
                {
                    Console.WriteLine("Number is found at "+i);
                }
                else
                {
                    Console.WriteLine("Number is not found");                
                }
            }
            Console.ReadLine();                      
       }
    }
}

Popular 5 Posts Last 7 days