0% found this document useful (0 votes)
8 views

Visual Studio

The document provides examples of C# code using an online compiler, demonstrating basic programming concepts such as variable declaration, logical operators, and loops. It includes a simple program that prints 'Hello' ten times and showcases the use of AND, OR, and NOT operators. Additionally, it highlights the main method as the execution point of the program.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Visual Studio

The document provides examples of C# code using an online compiler, demonstrating basic programming concepts such as variable declaration, logical operators, and loops. It includes a simple program that prints 'Hello' ten times and showcases the use of AND, OR, and NOT operators. Additionally, it highlights the main method as the execution point of the program.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Visual Studio

// Online C# Editor for free


// Write, Edit and Run your C# code using C# Online Compiler

using System;

public class HelloWorld


{
public static void Main(string[] args)
{
Console.WriteLine ("Try programiz.pro");
}
}

// Online C# Editor for free


// Write, Edit and Run your C# code using C# Online Compiler

using System;

public class HelloWorld


{
public static void Main(string[] args)
{
/*
The main method is the execution point of the program
It is a special method.For a method you can have only one method
*/
int num1; //Declaration of a variable
bool val1,val2,val3; //Variables of the same data type can be declared together
string name;
name=Console.ReadLine();
num1=100; //Assign a value to the variable
val1=(num1<50) && (num1>5);//AND Operator
val2=(num1<50) || (num1>5);//OR Operator
val3=!(num1<50) || (num1>5);//NOT Operator

Console.WriteLine (val1);
Console.WriteLine (val2);
Console.WriteLine (val3);
}
}
static void Main(string[] args)
{
//write a program to display "Hello" 10 times
int r = 1;
while (r <= 10) {
Console.WriteLine("Hello");
r++; //post increment
}
}

You might also like