Posts

Showing posts from July 22, 2014

How to Print in c sharp # without System namespace (using Microsoft visual studio 2010)

// In this code we demonstrate that we can print without using system namespace

using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Console.Write("yuyu \n");

           System.Console.Read();


        }
    }
}

Creating your own namespace in c sharp # using Microsoft visual studio 2010

// In this program we have created our own namespace in c#
using System;
using anuj;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            a ob = new a();

            ob.display();
            Console.Read();


        }
    }
}

namespace anuj
{
    public class a
    {
        public void display()
        {
            Console.WriteLine("this is a function call");
        }
    }
}

Jibo: World's first family robot

Image
For more info visit : www.myjibo.com

Pattern in c sharp # using Microsoft visual studio 2010

/*This is a c# program
input : 3
output:
  1
 0 1
0 1 0

*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, i, j, f = 1 ,sp,k;
            Console.Write("Enter a number \n");

            a = Convert.ToInt32(Console.ReadLine());
            sp = a - 1;

            for (i = 1; i <= a; i++)
            {
                for (k = sp; k >= 1; k--)
                    Console.Write(" ");

                for ( j = 1; j <= i; j++)
                {

                        Console.Write(f+" ");
                    if (f == 1) f = 0;
                    else f = 1;

                }
                sp--;
                Console.WriteLine();
            }
            Console.Read();// to hault the screen
        }
    }
}