SlideShare a Scribd company logo
C Sharp (C#)
By:
Ralph W.
Summary

Defining variables

Getting user input

Displaying user input

Finding odd or even numbers

Switch cases, looping, and logic statements

Comparing sub string within a another string

Clearing screen

Quitting Program
Defining variables

Byte – byte, 8 width, 0 -255

Signed byte – sbyte, 8 width, -127 to 127

integer – int, 32 width,
-2147483648 to 2127483647

String – string,

long, short, char, object, decimal, bool,
double, float, ulong, ushort,

ex: int value;
Getting user input

valueStr = Console.ReadLine()
Displaying user input

Console.WriteLine(valueStr);
Finding odd or even numbers

if(value % 2 != 0), odd

if(value % 2 == 0), even
Switches, loops, and logic

Switch ( caseNumber)
{ case 0: break; default: }

Do { // do something } while( condition);

While (condition) { // do something}

If (condition) { } else { }
Comparing strings

Compare String
String.Compare(str1, str2, true)
− True to ignore case during comparison,
otherwise false.
Clearing screen

Console.Clear();
Exiting Program

Normal exit
− Run a tight loop for the display
− Allow the user to select exit criteria
− Put up a warning message
− Allow the program to exit naturally

Graceful exit with exceptions
− If you want to get fancy you can catch
exceptions and exit gracefully
Extras

Structures

Classes

Linked Lists

Converting strings to integers

More Related Content

PPTX
Numeric Data Types & Strings
PPTX
Constant, variables, data types
PPTX
Constants and variables in c programming
PPTX
Data types in C
PDF
[ITP - Lecture 04] Variables and Constants in C/C++
PPTX
Data types
PPTX
Typecasting in c
DOCX
Data types and operators in vb
Numeric Data Types & Strings
Constant, variables, data types
Constants and variables in c programming
Data types in C
[ITP - Lecture 04] Variables and Constants in C/C++
Data types
Typecasting in c
Data types and operators in vb

What's hot (19)

PPTX
JAVA Literals
PPTX
Operators , Functions and Options in VB.NET
PPT
constants, variables and datatypes in C
PDF
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
PPTX
Type casting
PDF
[ITP - Lecture 05] Datatypes
PPTX
Character set of c
PPT
Basic of c &c++
PPT
3 data-types-in-c
PPT
Ppt lesson 08
PPTX
C data types, arrays and structs
PPT
Data types and Operators
PPT
Enumerated data types in C
PPTX
arrays and pointers
PPTX
Lecture no 1
PPT
Ppt lesson 07
PPT
Lect 9(pointers) Zaheer Abbas
PPTX
Data Type in C Programming
PPSX
Type conversion
JAVA Literals
Operators , Functions and Options in VB.NET
constants, variables and datatypes in C
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
Type casting
[ITP - Lecture 05] Datatypes
Character set of c
Basic of c &c++
3 data-types-in-c
Ppt lesson 08
C data types, arrays and structs
Data types and Operators
Enumerated data types in C
arrays and pointers
Lecture no 1
Ppt lesson 07
Lect 9(pointers) Zaheer Abbas
Data Type in C Programming
Type conversion
Ad

Viewers also liked (10)

DOCX
CV Rauf
PDF
Muhammad imtiaz azam. Cv
PPTX
6º módulo 1ª aula
PDF
Resume_Irshad
PPTX
Water alternating gas (WAG) - A Enhanced Oil Recovery technique
PDF
Cellgen - Companion Diagnostic Platform
PDF
Beyond Basic VoLTE Services: Avoiding 3 Mistakes of the Past
PPTX
4º módulo 4ª aula
PPTX
5º módulo 1ª aula
PDF
BCH Electric Limited- Complete Product Range Catalogue
CV Rauf
Muhammad imtiaz azam. Cv
6º módulo 1ª aula
Resume_Irshad
Water alternating gas (WAG) - A Enhanced Oil Recovery technique
Cellgen - Companion Diagnostic Platform
Beyond Basic VoLTE Services: Avoiding 3 Mistakes of the Past
4º módulo 4ª aula
5º módulo 1ª aula
BCH Electric Limited- Complete Product Range Catalogue
Ad

Similar to C sharp_basic_ideas (20)

DOCX
C# language basics (Visual Studio)
DOCX
C# language basics (Visual studio)
PDF
Loops and conditional statements
PDF
OIT 116 LOOPS AND CONDITION STATEMENTS.pdf
PPTX
Advanced Computer Programming..pptx
PPT
Lecture 3
PPTX
Operators loops conditional and statements
PPTX
#c training and knowlege of c-sharp program.pptx
PPTX
Chapter i c#(console application and programming)
PPTX
10control statement in c#
PDF
Xamarin: Branching and Looping
PDF
C sharp chap4
PPTX
Flow Control and Exception Handling.pptx
PPTX
Chapter3: fundamental programming
PDF
Introduction to c first week slides
PDF
Programming basics
PPTX
C language (1).pptxC language (1C language (1).pptx).pptx
PPT
C Sharp Jn (3)
PPSX
C# - Part 1
C# language basics (Visual Studio)
C# language basics (Visual studio)
Loops and conditional statements
OIT 116 LOOPS AND CONDITION STATEMENTS.pdf
Advanced Computer Programming..pptx
Lecture 3
Operators loops conditional and statements
#c training and knowlege of c-sharp program.pptx
Chapter i c#(console application and programming)
10control statement in c#
Xamarin: Branching and Looping
C sharp chap4
Flow Control and Exception Handling.pptx
Chapter3: fundamental programming
Introduction to c first week slides
Programming basics
C language (1).pptxC language (1C language (1).pptx).pptx
C Sharp Jn (3)
C# - Part 1

C sharp_basic_ideas