SlideShare a Scribd company logo
C             Programming
                       Language
               By:
    Yogendra Pal
yogendra@learnbywatch.com
  Dedicated to My mother and Father
t
                                                               y
         Keep your notebook with you.

Write important point and questions that comes in your mind

     Solve Mind band exercise.


                                                               C
                                       Rewind when not clear


              Ask Questions by call or SMS or by mail


Keep Watching Keep Learning

THIS IS ARITHMETIC INSTRUCTIONS


                                   2
What do you know?
•   printf() function?
•   scanf() function?
•   How to write a simple C program?
•   How to compile and run it?
•   If answers are yes then you can go ahead.



                          3
Problem
• Write a program to add two numbers. These
  numbers must input by user.
• For addition (+) we need arithmetic operators.




                        4
Arithmetic Operators
•   * : multiplication         y         z
                               2         4
•   / : division
•   + : addition
•   - : subtraction                2+4
                                    x
•   % : modulus operator            6

•   Variable = constant;
    – x = y + z;

                           5
Result of each operator
•   2*3=6
•   4/2=2
•   4+2=6
•   4–2=2
•   4%3=1
•   4%2=0


                  6
Some Constraints
• Arithmetic operators act on numeric values.
  – (int/float/char) operator (int/float/char)
  – character represents numeric (ASCII) value.
• Modules operator works only when
  – int % int (non-zero).
• Division operator works only when
  – (int/float/char) / (non-zero value).


                             7
You must know
•   int / int = int
•   (int / float) = float
•   (float / int) = float
•   (float / float) = float




                              8
Assignment Operator =
• Assign expression value to an identifier.
• identifier = expression or variable = constant.
• If both operand are of different data types
  then right side value convert into the data
  type of left side identifier.
• Multiple assignment execute from right to left.
  – x = y = z = 5.


                        9
More Assignment Operator…
• *=, /=, %=, +=, -= know as compound
  assignment operator.
• x += 1; means x = x + 1;
• a -= b; means a = a – b;
• m %= (n-7); means m = m % (n-7);




                  10
Addition of two numbers
    start           start
                                  #include<stdio.h>
                                  #include<conio.h>
Define a,b,c      int a,b,c
                                  void main()
initialize b,c   b = 4, c = 2     {
                                            int a, b, c;
 a=b+c            a=b+c                     b = 4;
                                            c = 2;
   print a         print a                  a = b + c;
                                            printf(“%d”,a);
                                            getch();
    stop            stop          }

                             11
Unary Operators
•   Operate upon single operand.
•   - (unary minus)
•   + (unary plus)
•   -- (decrement operator) : decrement by 1
    – i--; or --i; equal to i = i -1;
• ++ (increment operator) : increment by 1
    – i++; or ++i; equal to i = i +1;

                                   12
Unary Operator…
• sizeof : returns the size (bytes) of operand.
  – printf(“integer: %d”,sizeof(i));
• Type Cast is also a unary operator.
• Type Cast changes the data type of operand.
  – (Type) operand;
  – float a = 3.7;
  – (int)a;


                             13
Operator precedence
Operator         Operation                     Precendence
()               Parentheses                   Evaluate First,
                                               Innermost first,
                                               Left to right.
-, +, --, ++,    Unary operators               Right to left
sizeof, (type)
*, / or %        Multiplication, Division or   Left to right.
                 modulus
+ or -           Addition and subtraction      Left to right.
=                Assignment (Multiple)         Right to left.


                                     14
Example of precedence
•   a=2*3/4+4/4+8–2+5/ (3+1)
•   a=2*3/4+4/4+8–2+5/ 4
•   a=6/4+4/4+8–2+5/ 4
•   a=1+4/4+8–2+5/ 4
•   a=1+1+8–2+5/ 4
•   a=1+1+8–2+1
•   a=2+8–2+1
•   a = 10 – 2 + 1
•   a=8+1
•   a=9

                      15
Mind Bend
• Calculate the value.
  – ( 3 * 5.9 – 2 * 6 ) % ( 4 * 8 + 4 )
  –2*((8/6)+(4*(9–4))%(3*2–2)
  – ( 3 * 9 - 3 ) % ( 5 + 3 * 3) / ( 6 - 7 )




                          16
Calculate the average
    start              start


Define a,b,c       Define a,b,c

initialize b,c     initialize b,c

a=b+c/2            a=(b+c)/2

   print a            print a


    stop               stop

                           17
Problem
• Write a program to convert a value from
  kilometer to meter.
• Formula to convert km in to meter is:
  – 1 km = 1000 m so,
  – n km = 1000 * n m
• Now you can solve any formula based
  problem.

                        18
Problem…
• Write a program that convert a lowercase
  character to uppercase character.
• Write a program to calculate the area and
  circumference of the circle.
• Two numbers (x and y) are entered through the
  keyboard. Write a program to interchange the
  value of x and y.
• Write a program that print reverse of a 5 digit
  given number.

                        19
Problem…
• Write a program that calculate the root of a
  quadratic equation.
  – ax2 + bx + c = 0.
• Input marks of five subjects of a student and
  write a program to calculate and print addition
  and percentage of that student.



                           20
Mind Bend
• Write a program that convert a uppercase
  alphabet to lowercase alphabet.
• Write a program to calculate the area and
  perimeter of rectangle.
• Write a program that print reverse of a 3 digit
  given number.



                        21
To get complete benefit of this tutorial solve all the quiz on
                       www.learnbywatch.com

              For any problem in this tutorial mail me at
                    yogendra@learnbywatch.com
                        with the subject “C”

                     For Other information mail at
                       info@learnbywatch.com


Keep Watching Keep Learning

NEXT IS DECISION CONTROL

                                    22

More Related Content

What's hot

2. operators in c
2. operators in c2. operators in c
2. operators in c
amar kakde
 
C operators
C operatorsC operators
C operators
GPERI
 
Operators in c language
Operators in c languageOperators in c language
Operators in c languageAmit Singh
 
C language operators
C language operatorsC language operators
C language operators
marar hina
 
Relational operators In C language (By: Shujaat Abbas)
Relational operators In C language (By: Shujaat Abbas)Relational operators In C language (By: Shujaat Abbas)
Relational operators In C language (By: Shujaat Abbas)
Shujaat Abbas
 
Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
Manoj Tyagi
 
C OPERATOR
C OPERATORC OPERATOR
C OPERATOR
rricky98
 
C Building Blocks
C Building Blocks C Building Blocks
C Building Blocks
imtiazalijoono
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1
Zaibi Gondal
 
Lect08 exercises
Lect08 exercisesLect08 exercises
Lect08 exercisesAKalaji
 
6 operators-in-c
6 operators-in-c6 operators-in-c
6 operators-in-c
Rohit Shrivastava
 
Types of operators in C
Types of operators in CTypes of operators in C
Types of operators in C
Prabhu Govind
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssionseShikshak
 
Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in JavaAbhilash Nair
 
C operator and expression
C operator and expressionC operator and expression
C operator and expression
LavanyaManokaran
 
4. operators in c programming by digital wave
4. operators in  c programming by digital wave4. operators in  c programming by digital wave
4. operators in c programming by digital wave
RahulSharma4566
 

What's hot (20)

2. operators in c
2. operators in c2. operators in c
2. operators in c
 
C operators
C operatorsC operators
C operators
 
Prefix Postfix
Prefix PostfixPrefix Postfix
Prefix Postfix
 
Operators in c language
Operators in c languageOperators in c language
Operators in c language
 
C language operators
C language operatorsC language operators
C language operators
 
Relational operators In C language (By: Shujaat Abbas)
Relational operators In C language (By: Shujaat Abbas)Relational operators In C language (By: Shujaat Abbas)
Relational operators In C language (By: Shujaat Abbas)
 
Operator in c programming
Operator in c programmingOperator in c programming
Operator in c programming
 
Working with IDE
Working with IDEWorking with IDE
Working with IDE
 
C OPERATOR
C OPERATORC OPERATOR
C OPERATOR
 
C Building Blocks
C Building Blocks C Building Blocks
C Building Blocks
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1
 
Lect08 exercises
Lect08 exercisesLect08 exercises
Lect08 exercises
 
6 operators-in-c
6 operators-in-c6 operators-in-c
6 operators-in-c
 
Types of operators in C
Types of operators in CTypes of operators in C
Types of operators in C
 
C – operators and expressions
C – operators and expressionsC – operators and expressions
C – operators and expressions
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssions
 
Operators and Expressions in Java
Operators and Expressions in JavaOperators and Expressions in Java
Operators and Expressions in Java
 
C operator and expression
C operator and expressionC operator and expression
C operator and expression
 
4. operators in c programming by digital wave
4. operators in  c programming by digital wave4. operators in  c programming by digital wave
4. operators in c programming by digital wave
 
Operators in C++
Operators in C++Operators in C++
Operators in C++
 

Viewers also liked

Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions set
Robert Almazan
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
Robert Almazan
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Jay Patel
 
1.arithmetic & logical operations
1.arithmetic & logical operations1.arithmetic & logical operations
1.arithmetic & logical operations
mukesh bhardwaj
 
How to perform well in a job interview
How to perform well in a job interviewHow to perform well in a job interview
How to perform well in a job interview
Tien Nguyen Thanh
 
Addressing mode & data transfer instruction of 8085
Addressing mode & data transfer instruction of 8085Addressing mode & data transfer instruction of 8085
Addressing mode & data transfer instruction of 8085
Chinmayee samal
 
Complements
ComplementsComplements
Complements
Sudheesh S Madhav
 
1's and 2's complement
1's and 2's complement 1's and 2's complement
1's and 2's complement
Shiraz Azeem
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructions
ihsanjamil
 
1s and 2s complement
1s and 2s complement1s and 2s complement
1s and 2s complement
Then Murugeshwari
 
Question paper with solution the 8051 microcontroller based embedded systems...
Question paper with solution  the 8051 microcontroller based embedded systems...Question paper with solution  the 8051 microcontroller based embedded systems...
Question paper with solution the 8051 microcontroller based embedded systems...
manishpatel_79
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Frankie Jones
 
Interviewing PPT
Interviewing PPTInterviewing PPT
Interviewing PPT
Eric Machan Howd
 

Viewers also liked (14)

Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions set
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
 
1.arithmetic & logical operations
1.arithmetic & logical operations1.arithmetic & logical operations
1.arithmetic & logical operations
 
How to perform well in a job interview
How to perform well in a job interviewHow to perform well in a job interview
How to perform well in a job interview
 
Addressing mode & data transfer instruction of 8085
Addressing mode & data transfer instruction of 8085Addressing mode & data transfer instruction of 8085
Addressing mode & data transfer instruction of 8085
 
Microprocessor systems (4)
Microprocessor systems (4)Microprocessor systems (4)
Microprocessor systems (4)
 
Complements
ComplementsComplements
Complements
 
1's and 2's complement
1's and 2's complement 1's and 2's complement
1's and 2's complement
 
Types of instructions
Types of instructionsTypes of instructions
Types of instructions
 
1s and 2s complement
1s and 2s complement1s and 2s complement
1s and 2s complement
 
Question paper with solution the 8051 microcontroller based embedded systems...
Question paper with solution  the 8051 microcontroller based embedded systems...Question paper with solution  the 8051 microcontroller based embedded systems...
Question paper with solution the 8051 microcontroller based embedded systems...
 
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMINGChapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Chapter 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
 
Interviewing PPT
Interviewing PPTInterviewing PPT
Interviewing PPT
 

Similar to Arithmetic instructions

B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2
Tekendra Nath Yogi
 
Workshop03.docx lap trinh C cho người mới bắt đầu
Workshop03.docx  lap trinh C cho người mới bắt đầuWorkshop03.docx  lap trinh C cho người mới bắt đầu
Workshop03.docx lap trinh C cho người mới bắt đầu
linhtran111111111111
 
c-programming
c-programmingc-programming
c-programming
Zulhazmi Harith
 
Python.pptx
Python.pptxPython.pptx
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
Arul Jothi Yuvaraja
 
C operators
C operators C operators
C operators
AbiramiT9
 
C-LOOP-Session-2.pptx
C-LOOP-Session-2.pptxC-LOOP-Session-2.pptx
C-LOOP-Session-2.pptx
Sarkunavathi Aribal
 
C Programming Introduction
C Programming IntroductionC Programming Introduction
C Programming Introduction
Honey Sharma
 
Dti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionDti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionalish sha
 
C language basics
C language basicsC language basics
C language basics
Milind Deshkar
 
Programming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptxProgramming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptx
SONU KUMAR
 
25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual
kamesh dagia
 
Ch02 primitive-data-definite-loops
Ch02 primitive-data-definite-loopsCh02 primitive-data-definite-loops
Ch02 primitive-data-definite-loops
James Brotsos
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 studrohassanie
 
Programming For Engineers Functions - Part #1.pptx
Programming For Engineers Functions - Part #1.pptxProgramming For Engineers Functions - Part #1.pptx
Programming For Engineers Functions - Part #1.pptx
NoorAntakia
 
C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh
AnkitSinghRajput35
 
Lecture1
Lecture1Lecture1
Lecture1
Amisha Dalal
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
Gradeup
 
Course project solutions 2019
Course project solutions 2019Course project solutions 2019
Course project solutions 2019
Robert Geofroy
 

Similar to Arithmetic instructions (20)

B.sc CSIT 2nd semester C++ Unit2
B.sc CSIT  2nd semester C++ Unit2B.sc CSIT  2nd semester C++ Unit2
B.sc CSIT 2nd semester C++ Unit2
 
ICP - Lecture 5
ICP - Lecture 5ICP - Lecture 5
ICP - Lecture 5
 
Workshop03.docx lap trinh C cho người mới bắt đầu
Workshop03.docx  lap trinh C cho người mới bắt đầuWorkshop03.docx  lap trinh C cho người mới bắt đầu
Workshop03.docx lap trinh C cho người mới bắt đầu
 
c-programming
c-programmingc-programming
c-programming
 
Python.pptx
Python.pptxPython.pptx
Python.pptx
 
Lecture 7.pptx
Lecture 7.pptxLecture 7.pptx
Lecture 7.pptx
 
C operators
C operators C operators
C operators
 
C-LOOP-Session-2.pptx
C-LOOP-Session-2.pptxC-LOOP-Session-2.pptx
C-LOOP-Session-2.pptx
 
C Programming Introduction
C Programming IntroductionC Programming Introduction
C Programming Introduction
 
Dti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpressionDti2143 chapter 3 arithmatic relation-logicalexpression
Dti2143 chapter 3 arithmatic relation-logicalexpression
 
C language basics
C language basicsC language basics
C language basics
 
Programming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptxProgramming in C by SONU KUMAR.pptx
Programming in C by SONU KUMAR.pptx
 
25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual25422733 c-programming-and-data-structures-lab-manual
25422733 c-programming-and-data-structures-lab-manual
 
Ch02 primitive-data-definite-loops
Ch02 primitive-data-definite-loopsCh02 primitive-data-definite-loops
Ch02 primitive-data-definite-loops
 
Labsheet2 stud
Labsheet2 studLabsheet2 stud
Labsheet2 stud
 
Programming For Engineers Functions - Part #1.pptx
Programming For Engineers Functions - Part #1.pptxProgramming For Engineers Functions - Part #1.pptx
Programming For Engineers Functions - Part #1.pptx
 
C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh C - programming - Ankit Kumar Singh
C - programming - Ankit Kumar Singh
 
Lecture1
Lecture1Lecture1
Lecture1
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
 
Course project solutions 2019
Course project solutions 2019Course project solutions 2019
Course project solutions 2019
 

More from Learn By Watch

Tutorial 9 fm
Tutorial 9 fmTutorial 9 fm
Tutorial 9 fm
Learn By Watch
 
Phase modulation
Phase modulationPhase modulation
Phase modulation
Learn By Watch
 
Demodulation of fm pll detector
Demodulation of fm pll detectorDemodulation of fm pll detector
Demodulation of fm pll detector
Learn By Watch
 
Demodulation of fm slope and balanced slope detector
Demodulation of fm slope and balanced slope detectorDemodulation of fm slope and balanced slope detector
Demodulation of fm slope and balanced slope detector
Learn By Watch
 
In direct method of fm generation armstrong method
In direct method of fm generation armstrong methodIn direct method of fm generation armstrong method
In direct method of fm generation armstrong method
Learn By Watch
 
Direct method of fm generation hartley oscillator method
Direct method of fm generation hartley oscillator methodDirect method of fm generation hartley oscillator method
Direct method of fm generation hartley oscillator method
Learn By Watch
 
Carson's rule
Carson's ruleCarson's rule
Carson's rule
Learn By Watch
 
Spectrum and power of wbfm
Spectrum and power of wbfmSpectrum and power of wbfm
Spectrum and power of wbfm
Learn By Watch
 
Narrow band frequency modulation nbfm
Narrow band frequency modulation nbfmNarrow band frequency modulation nbfm
Narrow band frequency modulation nbfm
Learn By Watch
 
General expression of fm signal
General expression of fm signalGeneral expression of fm signal
General expression of fm signal
Learn By Watch
 
Angle modulation
Angle modulationAngle modulation
Angle modulation
Learn By Watch
 
Frequency division multiplexing
Frequency division multiplexingFrequency division multiplexing
Frequency division multiplexing
Learn By Watch
 
Vsb modulation
Vsb modulationVsb modulation
Vsb modulation
Learn By Watch
 
Demodulation of ssb synchronous detector
Demodulation of ssb synchronous detectorDemodulation of ssb synchronous detector
Demodulation of ssb synchronous detector
Learn By Watch
 
Generarion of ssb phase discrimination method
Generarion of ssb phase discrimination methodGenerarion of ssb phase discrimination method
Generarion of ssb phase discrimination method
Learn By Watch
 
Generarion of ssb frequency discrimination method
Generarion of ssb frequency discrimination methodGenerarion of ssb frequency discrimination method
Generarion of ssb frequency discrimination method
Learn By Watch
 
Ssb modulation
Ssb modulationSsb modulation
Ssb modulation
Learn By Watch
 
Demodulation of dsb sc costas receiver
Demodulation of dsb sc costas receiverDemodulation of dsb sc costas receiver
Demodulation of dsb sc costas receiver
Learn By Watch
 
Quadrature carrier multiplexing qam
Quadrature carrier multiplexing qamQuadrature carrier multiplexing qam
Quadrature carrier multiplexing qam
Learn By Watch
 
Demodulation of am synchronous detector
Demodulation of am synchronous detectorDemodulation of am synchronous detector
Demodulation of am synchronous detector
Learn By Watch
 

More from Learn By Watch (20)

Tutorial 9 fm
Tutorial 9 fmTutorial 9 fm
Tutorial 9 fm
 
Phase modulation
Phase modulationPhase modulation
Phase modulation
 
Demodulation of fm pll detector
Demodulation of fm pll detectorDemodulation of fm pll detector
Demodulation of fm pll detector
 
Demodulation of fm slope and balanced slope detector
Demodulation of fm slope and balanced slope detectorDemodulation of fm slope and balanced slope detector
Demodulation of fm slope and balanced slope detector
 
In direct method of fm generation armstrong method
In direct method of fm generation armstrong methodIn direct method of fm generation armstrong method
In direct method of fm generation armstrong method
 
Direct method of fm generation hartley oscillator method
Direct method of fm generation hartley oscillator methodDirect method of fm generation hartley oscillator method
Direct method of fm generation hartley oscillator method
 
Carson's rule
Carson's ruleCarson's rule
Carson's rule
 
Spectrum and power of wbfm
Spectrum and power of wbfmSpectrum and power of wbfm
Spectrum and power of wbfm
 
Narrow band frequency modulation nbfm
Narrow band frequency modulation nbfmNarrow band frequency modulation nbfm
Narrow band frequency modulation nbfm
 
General expression of fm signal
General expression of fm signalGeneral expression of fm signal
General expression of fm signal
 
Angle modulation
Angle modulationAngle modulation
Angle modulation
 
Frequency division multiplexing
Frequency division multiplexingFrequency division multiplexing
Frequency division multiplexing
 
Vsb modulation
Vsb modulationVsb modulation
Vsb modulation
 
Demodulation of ssb synchronous detector
Demodulation of ssb synchronous detectorDemodulation of ssb synchronous detector
Demodulation of ssb synchronous detector
 
Generarion of ssb phase discrimination method
Generarion of ssb phase discrimination methodGenerarion of ssb phase discrimination method
Generarion of ssb phase discrimination method
 
Generarion of ssb frequency discrimination method
Generarion of ssb frequency discrimination methodGenerarion of ssb frequency discrimination method
Generarion of ssb frequency discrimination method
 
Ssb modulation
Ssb modulationSsb modulation
Ssb modulation
 
Demodulation of dsb sc costas receiver
Demodulation of dsb sc costas receiverDemodulation of dsb sc costas receiver
Demodulation of dsb sc costas receiver
 
Quadrature carrier multiplexing qam
Quadrature carrier multiplexing qamQuadrature carrier multiplexing qam
Quadrature carrier multiplexing qam
 
Demodulation of am synchronous detector
Demodulation of am synchronous detectorDemodulation of am synchronous detector
Demodulation of am synchronous detector
 

Recently uploaded

The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Reflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdfReflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdf
amberjdewit93
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Delivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and TrainingDelivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and Training
AG2 Design
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptxFresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
SriSurya50
 
Reflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPointReflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPoint
amberjdewit93
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
christianmathematics
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 

Recently uploaded (20)

The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Reflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdfReflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdf
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Delivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and TrainingDelivering Micro-Credentials in Technical and Vocational Education and Training
Delivering Micro-Credentials in Technical and Vocational Education and Training
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptxFresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
 
Reflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPointReflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPoint
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 

Arithmetic instructions

  • 1. C Programming Language By: Yogendra Pal yogendra@learnbywatch.com Dedicated to My mother and Father
  • 2. t y Keep your notebook with you. Write important point and questions that comes in your mind Solve Mind band exercise. C Rewind when not clear Ask Questions by call or SMS or by mail Keep Watching Keep Learning THIS IS ARITHMETIC INSTRUCTIONS 2
  • 3. What do you know? • printf() function? • scanf() function? • How to write a simple C program? • How to compile and run it? • If answers are yes then you can go ahead. 3
  • 4. Problem • Write a program to add two numbers. These numbers must input by user. • For addition (+) we need arithmetic operators. 4
  • 5. Arithmetic Operators • * : multiplication y z 2 4 • / : division • + : addition • - : subtraction 2+4 x • % : modulus operator 6 • Variable = constant; – x = y + z; 5
  • 6. Result of each operator • 2*3=6 • 4/2=2 • 4+2=6 • 4–2=2 • 4%3=1 • 4%2=0 6
  • 7. Some Constraints • Arithmetic operators act on numeric values. – (int/float/char) operator (int/float/char) – character represents numeric (ASCII) value. • Modules operator works only when – int % int (non-zero). • Division operator works only when – (int/float/char) / (non-zero value). 7
  • 8. You must know • int / int = int • (int / float) = float • (float / int) = float • (float / float) = float 8
  • 9. Assignment Operator = • Assign expression value to an identifier. • identifier = expression or variable = constant. • If both operand are of different data types then right side value convert into the data type of left side identifier. • Multiple assignment execute from right to left. – x = y = z = 5. 9
  • 10. More Assignment Operator… • *=, /=, %=, +=, -= know as compound assignment operator. • x += 1; means x = x + 1; • a -= b; means a = a – b; • m %= (n-7); means m = m % (n-7); 10
  • 11. Addition of two numbers start start #include<stdio.h> #include<conio.h> Define a,b,c int a,b,c void main() initialize b,c b = 4, c = 2 { int a, b, c; a=b+c a=b+c b = 4; c = 2; print a print a a = b + c; printf(“%d”,a); getch(); stop stop } 11
  • 12. Unary Operators • Operate upon single operand. • - (unary minus) • + (unary plus) • -- (decrement operator) : decrement by 1 – i--; or --i; equal to i = i -1; • ++ (increment operator) : increment by 1 – i++; or ++i; equal to i = i +1; 12
  • 13. Unary Operator… • sizeof : returns the size (bytes) of operand. – printf(“integer: %d”,sizeof(i)); • Type Cast is also a unary operator. • Type Cast changes the data type of operand. – (Type) operand; – float a = 3.7; – (int)a; 13
  • 14. Operator precedence Operator Operation Precendence () Parentheses Evaluate First, Innermost first, Left to right. -, +, --, ++, Unary operators Right to left sizeof, (type) *, / or % Multiplication, Division or Left to right. modulus + or - Addition and subtraction Left to right. = Assignment (Multiple) Right to left. 14
  • 15. Example of precedence • a=2*3/4+4/4+8–2+5/ (3+1) • a=2*3/4+4/4+8–2+5/ 4 • a=6/4+4/4+8–2+5/ 4 • a=1+4/4+8–2+5/ 4 • a=1+1+8–2+5/ 4 • a=1+1+8–2+1 • a=2+8–2+1 • a = 10 – 2 + 1 • a=8+1 • a=9 15
  • 16. Mind Bend • Calculate the value. – ( 3 * 5.9 – 2 * 6 ) % ( 4 * 8 + 4 ) –2*((8/6)+(4*(9–4))%(3*2–2) – ( 3 * 9 - 3 ) % ( 5 + 3 * 3) / ( 6 - 7 ) 16
  • 17. Calculate the average start start Define a,b,c Define a,b,c initialize b,c initialize b,c a=b+c/2 a=(b+c)/2 print a print a stop stop 17
  • 18. Problem • Write a program to convert a value from kilometer to meter. • Formula to convert km in to meter is: – 1 km = 1000 m so, – n km = 1000 * n m • Now you can solve any formula based problem. 18
  • 19. Problem… • Write a program that convert a lowercase character to uppercase character. • Write a program to calculate the area and circumference of the circle. • Two numbers (x and y) are entered through the keyboard. Write a program to interchange the value of x and y. • Write a program that print reverse of a 5 digit given number. 19
  • 20. Problem… • Write a program that calculate the root of a quadratic equation. – ax2 + bx + c = 0. • Input marks of five subjects of a student and write a program to calculate and print addition and percentage of that student. 20
  • 21. Mind Bend • Write a program that convert a uppercase alphabet to lowercase alphabet. • Write a program to calculate the area and perimeter of rectangle. • Write a program that print reverse of a 3 digit given number. 21
  • 22. To get complete benefit of this tutorial solve all the quiz on www.learnbywatch.com For any problem in this tutorial mail me at yogendra@learnbywatch.com with the subject “C” For Other information mail at info@learnbywatch.com Keep Watching Keep Learning NEXT IS DECISION CONTROL 22