Wednesday, 3 January 2018

Simple Calculator Program in C#(sharp)

                   Simple Calculator Program in C#(sharp)

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

namespace calculator
{
    class Program
    {
        static void Main(string[] args)
        {    
            //basic Calculator program//
             double Num,result; //
           
            bool isNum1 = double.TryParse(args[0], out Num); // converting string to double if a conversion succeeded then  isNum is true otherwise false
            bool isNum2 = double.TryParse(args[2], out Num);
            if (isNum1 && isNum2) // if isnum1 and isnum2 is numeric value than execute if block otherwise execute else block
            {
                try
                {

                    char operant = Convert.ToChar(args[1]); // convert string to char
                    switch (operant) // using switch block for checking operant
                    { 
                        case '+':
                            result = double.Parse(args[0]) + double.Parse(args[2]); //add two values
                            Console.WriteLine("{0} + {1} = {2}", args[0], args[2], result); // print result
                            break;
                        case '-':
                            result = double.Parse(args[0]) - double.Parse(args[2]); //add two values
                            Console.WriteLine("{0} - {1} = {2}", args[0], args[2], result); // print result
                            break;
                        case '*':
                            result = double.Parse(args[0]) * double.Parse(args[2]);
                            Console.WriteLine("{0} * {1} = {2}", args[0], args[2], result); // print result
                            break;
                        case '/':
                            result = double.Parse(args[0]) / double.Parse(args[2]);
                            Console.WriteLine("{0} * {1} = {2}", args[0], args[2], result); // print result
                            break;
                        default:
                            Console.WriteLine("Wrong operation"); // if user using the(apart from these +,-,*,/) other operant than print the wrong operation
                            break;
                    }
                    }
                   catch (Exception e)
                  {
                    Console.WriteLine("using calculator with the correct values...");  // handling catching exception
                    Console.WriteLine("Error is that " + e);
                    Console.ReadLine();
                 }
                }
          else
            {
                Console.WriteLine("Wrong operation"); // if args[0] and args[2] is not number then execute else block
            
            }
     
       }
    }
}

Hello World Program in C#

                           Hello World Program in C#

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

namespace HelloWorld
{
    class Program
    {
        static void Main(string[] args)
        {
             //Hello World Program//
            string name;
            Console.Write("Enter your name=>");
            name = Console.ReadLine(); // store user name in name variable
           
          
            if (DateTime.Now.TimeOfDay.TotalHours >= 6 && DateTime.Now.TimeOfDay.TotalHours < 12)// using 24 hour 1-24
            {
                Console.WriteLine("Good Morning " + name);
                Console.ReadLine();
            }
            else if (DateTime.Now.TimeOfDay.TotalHours >= 12 && DateTime.Now.TimeOfDay.TotalHours < 16)
            {

                Console.WriteLine("GoodAfterNoon " + name);
                Console.ReadLine();
            
            }
            else if (DateTime.Now.TimeOfDay.TotalHours >= 16 && DateTime.Now.TimeOfDay.TotalHours < 20)
            {
                Console.WriteLine("Good Evening " + name);
                Console.ReadLine();
            
            }
            else
            {
                Console.WriteLine("Good Night " + name);
                Console.ReadLine();
            }
        }
    }
}

Wednesday, 4 October 2017

www.youtube.com/c/computerstudy
Alt+FFile menu options in current program.
Alt+EEdit options in current program
Alt+TabSwitch between open programs
F1Universal Help in almost every Windows program.
F2Rename a selected file
F5Refresh the current program window
Ctrl+NCreate a new, blank document in some software programs
Ctrl+OOpen a file in current software program
Ctrl+ASelect all text.
Ctrl+BChange selected text to be Bold
Ctrl+IChange selected text to be in Italics
Ctrl+UChange selected text to be Underlined
Ctrl+FOpen find window for current document or window.
Ctrl+SSave current document file.
Ctrl+XCut selected item.
Shift+DelCut selected item.
Ctrl+CCopy selected item.
Ctrl+InsCopy selected item
Ctrl+VPaste
Shift+InsPaste
Ctrl+YRedo last action
Ctrl+ZUndo last action
Ctrl+KInsert hyperlink for selected text
Ctrl+PPrint the current page or document.
HomeGoes to beginning of current line.
Ctrl+HomeGoes to beginning of document.
EndGoes to end of current line.
Ctrl+EndGoes to end of document.
Shift+HomeHighlights from current position to beginning of line.
Shift+EndHighlights from current position to end of line.
Ctrl+Left arrowMoves one word to the left at a time.
Ctrl+Right arrowMoves one word to the right at a time.
Ctrl+EscOpens the START menu

Tuesday, 3 October 2017

Top 10 programming languages 2018

                      Top 10 programming languages 2018

1.Python
2.C
3.Java
4.C++
5.C#
6.R
7.JavaScript
8. PHP
9.Go
10.Swift

Wednesday, 2 August 2017

Tuesday, 1 August 2017

😍Developer on Weekends #shorts #officememes #developermemes

😍Developer on Weekends #shorts #officememes #developermemes Welcome to the latest viral YouTube shorts meme for developers! 😍Developer on...