SlideShare une entreprise Scribd logo
1  sur  12
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

Contenu connexe

Tendances

C sharp_basic_ideas
C sharp_basic_ideasC sharp_basic_ideas
C sharp_basic_ideas
Ralph Weber
 
Presentation 5th
Presentation 5thPresentation 5th
Presentation 5th
Connex
 
1.getting started with c
1.getting started with c1.getting started with c
1.getting started with c
Hardik gupta
 

Tendances (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
 

En vedette (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++
 

Similaire à Lecture no 1

C++ PROGRAMMING BASICS
C++ PROGRAMMING BASICSC++ PROGRAMMING BASICS
C++ PROGRAMMING BASICS
Aami Kakakhel
 
02. Data Type and Variables
02. Data Type and Variables02. Data Type and Variables
02. Data Type and Variables
Tommy Vercety
 

Similaire à 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
 

Dernier

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Dernier (20)

Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 

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