SlideShare a Scribd company logo
Variables and Data types
Variables
 Variables are analogous to Buckets or Envelopes where
information can be stored.
 We call buckets by names so Variables must have
names for calling.
 Information stored in Variables can also be changed.
 Name of the variable is anything your name also.
Data Types
 Data types tell about what type of value our variable
want to store
 It may be INT FLOAT DOUBLE CHAR STRING
 Int:-It will take only integer value no value after
decimal point
 Float:-It will take values after decimal point but has
less precison also known as floating point.
 Double:-Also called floating point because decimal
points flaot more precise than float
Data Types Continued
 Char:-It only takes a character it is one byte only takes
only character
 For examples
 Int =10
 Float=10.232
 Double=10.32322
 Char =‘d’
 Char =‘+’
Assignment Operator
 Assignment operator “=“ is used to assign value to a
variable
 Beware not used this “==“ be cause it is equality
operator it checks the equality between variable name
and value assigned to it.
 Syntax will be
 Data type variable name assignment operator value
Variable Names
 It is up to you what name you give to your variables
 For examples
 Int number=10;
 First DATA TYPE is INT as it only accept integer which is 10
 Second name of our variable is NUMBER name could be
anything here I used Number you can use your name also
 Third Assignment operator we give our variable Number a
value so after this
 Number=10 our variable number can store an integer
number 10.
Some Examples
 Int number=10;
 Int bob=20;
 Int khan=30;
 Float num=10.87;
 Float numbe=10.8;
 Double num1=10.2321;
 Double khan=10.43434;
Some Examples
 Char name=‘c’;
 Char ali=‘d’;
 Char sign=‘+’;
 Char bob=‘-’
 Char mult=‘*’;
 Note(we will discuss strings later it is also a data type i
will create full slides on strings)
Key Points For Char
 Char variable can be of 1 byte means it contain only
only character
 Char name=‘d’; TRUE
 Char name=‘d+’ FALSE
 Char sign=‘++’ FALSE
 Char sign=‘+’ True
 Always use this ‘’ for values
Comments
 Always use comments it is good programming pratice
 The benefit of commenting is that some one who sees
your code can easily understand it
 For comments use
 //this is my prog//
 Compiler can execute your programme line by line and
ignore the comments line it does not effect your
programme performance
 Use //I am a commnet//
Simple Example
In C++ In Java
 #include<iostream>
 using namespace std;
 int main()
 {
 int
number=10,number1=20,add;//i
nitialize variable and assign
values//
 add=number+number1;//result
of these will be stored in add//
 cout<<add;//for displaying//
 }
 Thanks to Devc++
 public class JavaApplication6 {
 /**
 * @param args the command line
arguments
 */
 public static void main(String[]
args) {
 int number=10,number1=20,add;
 add=number+number1;
 System.out.println(add);
 }

 }
 Thanks to netbeans
Thanks alot
Contact me at
muhammadhaseeb562@gmai
l.com
Mobile no:-
0336-5686312

More Related Content

What's hot

Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operatorsraksharao
 
C sharp_basic_ideas
C sharp_basic_ideasC sharp_basic_ideas
C sharp_basic_ideasRalph Weber
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingSaranyaK68
 
Presentation 5th
Presentation 5thPresentation 5th
Presentation 5thConnex
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++Neeru Mittal
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 
data types in C-Sharp (C#)
data types in C-Sharp (C#)data types in C-Sharp (C#)
data types in C-Sharp (C#)Abid Kohistani
 
Vb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary UploadVb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary UploadHock Leng PUAH
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programmingChitrank Dixit
 
1.getting started with c
1.getting started with c1.getting started with c
1.getting started with cHardik gupta
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C ProgrammingQazi Shahzad Ali
 

What's hot (16)

2 1 data
2 1  data2 1  data
2 1 data
 
Savitch Ch 17
Savitch Ch 17Savitch Ch 17
Savitch Ch 17
 
Lesson1
Lesson1Lesson1
Lesson1
 
Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operators
 
C sharp_basic_ideas
C sharp_basic_ideasC sharp_basic_ideas
C sharp_basic_ideas
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Presentation 5th
Presentation 5thPresentation 5th
Presentation 5th
 
Variables in C++, data types in c++
Variables in C++, data types in c++Variables in C++, data types in c++
Variables in C++, data types in c++
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
data types in C-Sharp (C#)
data types in C-Sharp (C#)data types in C-Sharp (C#)
data types in C-Sharp (C#)
 
Vb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary UploadVb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary Upload
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
1.getting started with c
1.getting started with c1.getting started with c
1.getting started with c
 
C++ data types
C++ data typesC++ data types
C++ data types
 
Character set of c
Character set of cCharacter set of c
Character set of c
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 

Viewers also liked

Viewers also liked (6)

PROGRAMACIÓN BÁSICA EN C++
PROGRAMACIÓN BÁSICA EN C++PROGRAMACIÓN BÁSICA EN C++
PROGRAMACIÓN BÁSICA EN C++
 
Presentación de C++
Presentación de C++Presentación de C++
Presentación de C++
 
Programación C++ - DEV C++
Programación C++ - DEV C++Programación C++ - DEV C++
Programación C++ - DEV C++
 
52 ejercicios-resueltos-en-pseudocodigo
52 ejercicios-resueltos-en-pseudocodigo52 ejercicios-resueltos-en-pseudocodigo
52 ejercicios-resueltos-en-pseudocodigo
 
Presentacion de c++
Presentacion de c++Presentacion de c++
Presentacion de c++
 
Programa c++
Programa c++Programa c++
Programa c++
 

Similar to Lecture no 1

CSharp Language Overview Part 1
CSharp Language Overview Part 1CSharp Language Overview Part 1
CSharp Language Overview Part 1Hossein Zahed
 
CS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdfCS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdfIda Lumintu
 
parts_of_python_programming_language.pptx
parts_of_python_programming_language.pptxparts_of_python_programming_language.pptx
parts_of_python_programming_language.pptxKoteswari Kasireddy
 
02 Primitive data types and variables
02 Primitive data types and variables02 Primitive data types and variables
02 Primitive data types and variablesmaznabili
 
02. Primitive Data Types and Variables
02. Primitive Data Types and Variables02. Primitive Data Types and Variables
02. Primitive Data Types and VariablesIntro C# Book
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data TypesTareq Hasan
 
Dr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javaDr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javajalinder123
 
Dr. Rajeshree Khande : Java Basics
Dr. Rajeshree Khande  : Java BasicsDr. Rajeshree Khande  : Java Basics
Dr. Rajeshree Khande : Java BasicsDrRajeshreeKhande
 
C++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSC++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSAami Kakakhel
 
02. Data Type and Variables
02. Data Type and Variables02. Data Type and Variables
02. Data Type and VariablesTommy Vercety
 
cprogrammingpointerstype.ppt
cprogrammingpointerstype.pptcprogrammingpointerstype.ppt
cprogrammingpointerstype.pptakila m
 

Similar to Lecture no 1 (20)

CSharp Language Overview Part 1
CSharp Language Overview Part 1CSharp Language Overview Part 1
CSharp Language Overview Part 1
 
CS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdfCS-XII Python Fundamentals.pdf
CS-XII Python Fundamentals.pdf
 
parts_of_python_programming_language.pptx
parts_of_python_programming_language.pptxparts_of_python_programming_language.pptx
parts_of_python_programming_language.pptx
 
02 Primitive data types and variables
02 Primitive data types and variables02 Primitive data types and variables
02 Primitive data types and variables
 
Pengaturcaraan asas
Pengaturcaraan asasPengaturcaraan asas
Pengaturcaraan asas
 
Pointers in C
Pointers in CPointers in C
Pointers in C
 
02. Primitive Data Types and Variables
02. Primitive Data Types and Variables02. Primitive Data Types and Variables
02. Primitive Data Types and Variables
 
Java: Primitive Data Types
Java: Primitive Data TypesJava: Primitive Data Types
Java: Primitive Data Types
 
Lect 8(pointers) Zaheer Abbas
Lect 8(pointers) Zaheer AbbasLect 8(pointers) Zaheer Abbas
Lect 8(pointers) Zaheer Abbas
 
Programming in Arduino (Part 1)
Programming in Arduino (Part 1)Programming in Arduino (Part 1)
Programming in Arduino (Part 1)
 
C# overview part 1
C# overview part 1C# overview part 1
C# overview part 1
 
Dr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic javaDr. Rajeshree Khande : Programming concept of basic java
Dr. Rajeshree Khande : Programming concept of basic java
 
Dr. Rajeshree Khande : Java Basics
Dr. Rajeshree Khande  : Java BasicsDr. Rajeshree Khande  : Java Basics
Dr. Rajeshree Khande : Java Basics
 
C++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSC++ PROGRAMMING BASICS
C++ PROGRAMMING BASICS
 
Pointers
PointersPointers
Pointers
 
02. Data Type and Variables
02. Data Type and Variables02. Data Type and Variables
02. Data Type and Variables
 
C++ programming
C++ programmingC++ programming
C++ programming
 
cprogrammingpointerstype.ppt
cprogrammingpointerstype.pptcprogrammingpointerstype.ppt
cprogrammingpointerstype.ppt
 
vb.net.pdf
vb.net.pdfvb.net.pdf
vb.net.pdf
 
Python
PythonPython
Python
 

Recently uploaded

Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfVivekanand Anglo Vedic Academy
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxakshayaramakrishnan21
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxJenilouCasareno
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...Sayali Powar
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasGeoBlogs
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptSourabh Kumar
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxbennyroshan06
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxDenish Jangid
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismDeeptiGupta154
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxRaedMohamed3
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chipsGeoBlogs
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleCeline George
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsCol Mukteshwar Prasad
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsparmarsneha2
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...Jisc
 

Recently uploaded (20)

Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptxMatatag-Curriculum and the 21st Century Skills Presentation.pptx
Matatag-Curriculum and the 21st Century Skills Presentation.pptx
 
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
UNIT – IV_PCI Complaints: Complaints and evaluation of complaints, Handling o...
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptxSolid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
Solid waste management & Types of Basic civil Engineering notes by DJ Sir.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
plant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated cropsplant breeding methods in asexually or clonally propagated crops
plant breeding methods in asexually or clonally propagated crops
 
B.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdfB.ed spl. HI pdusu exam paper-2023-24.pdf
B.ed spl. HI pdusu exam paper-2023-24.pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

Lecture no 1

  • 2. Variables  Variables are analogous to Buckets or Envelopes where information can be stored.  We call buckets by names so Variables must have names for calling.  Information stored in Variables can also be changed.  Name of the variable is anything your name also.
  • 3. Data Types  Data types tell about what type of value our variable want to store  It may be INT FLOAT DOUBLE CHAR STRING  Int:-It will take only integer value no value after decimal point  Float:-It will take values after decimal point but has less precison also known as floating point.  Double:-Also called floating point because decimal points flaot more precise than float
  • 4. Data Types Continued  Char:-It only takes a character it is one byte only takes only character  For examples  Int =10  Float=10.232  Double=10.32322  Char =‘d’  Char =‘+’
  • 5. Assignment Operator  Assignment operator “=“ is used to assign value to a variable  Beware not used this “==“ be cause it is equality operator it checks the equality between variable name and value assigned to it.  Syntax will be  Data type variable name assignment operator value
  • 6. Variable Names  It is up to you what name you give to your variables  For examples  Int number=10;  First DATA TYPE is INT as it only accept integer which is 10  Second name of our variable is NUMBER name could be anything here I used Number you can use your name also  Third Assignment operator we give our variable Number a value so after this  Number=10 our variable number can store an integer number 10.
  • 7. Some Examples  Int number=10;  Int bob=20;  Int khan=30;  Float num=10.87;  Float numbe=10.8;  Double num1=10.2321;  Double khan=10.43434;
  • 8. Some Examples  Char name=‘c’;  Char ali=‘d’;  Char sign=‘+’;  Char bob=‘-’  Char mult=‘*’;  Note(we will discuss strings later it is also a data type i will create full slides on strings)
  • 9. Key Points For Char  Char variable can be of 1 byte means it contain only only character  Char name=‘d’; TRUE  Char name=‘d+’ FALSE  Char sign=‘++’ FALSE  Char sign=‘+’ True  Always use this ‘’ for values
  • 10. Comments  Always use comments it is good programming pratice  The benefit of commenting is that some one who sees your code can easily understand it  For comments use  //this is my prog//  Compiler can execute your programme line by line and ignore the comments line it does not effect your programme performance  Use //I am a commnet//
  • 11. Simple Example In C++ In Java  #include<iostream>  using namespace std;  int main()  {  int number=10,number1=20,add;//i nitialize variable and assign values//  add=number+number1;//result of these will be stored in add//  cout<<add;//for displaying//  }  Thanks to Devc++  public class JavaApplication6 {  /**  * @param args the command line arguments  */  public static void main(String[] args) {  int number=10,number1=20,add;  add=number+number1;  System.out.println(add);  }   }  Thanks to netbeans
  • 12. Thanks alot Contact me at muhammadhaseeb562@gmai l.com Mobile no:- 0336-5686312