SlideShare a Scribd company logo
Introduction to ‘C’
Module 2.1
Compiled By :
Abhishek Sinha (MBA-IT, MCA)
Director – Academics
Concept Institute of Technology, Varanasi.
Website: www.conceptvns.org
Standard I/O Statements
What is an I/O statement?
Those statements which read data entered through
standard input device and display the values on
standard output device.
Types of Standard I/O Statement
Formatted I/O Statement Unformatted I/O Statement
Input Output Input Output
scanf() printf() getchar() putchar()
getche() putch()
getch()
gets() puts()
All these statements are stored in <stdio.h> header file.
Formatted Statements are those statements which facilitate the programmer
to perform I/O operations in all type of data type available in C, whereas in
Unformatted Statements, I/O operations can be performed in fixed format
(date type).
Syntaxes and Examples
scanf() : Standard Formatted Input Statement
syntax :
scanf(“<Format String>”,&<variable_name>)
or <Control String>
or <Format Specifier>
example : for single value input
int num;
scanf(“%d”,&num);
example : for multiple value input
int num1, num2;
float num3;
scanf(“%d%f%d”,&num1,&num3,&num2);
The use of scanf() statement provides interactivity and makes the program
user friendly.
Syntaxes and Examples
printf() : Standard Formatted Output Statement
syntax :
printf(“<Format String>”,<variable_name>)
or <Control String>
or <Format Specifier>
example : for single value output
int num=10;
printf(“%d”,num);
example : for multiple value output
int num1=10, num2=20;
float num3=30.5;
printf(“%d%f%d”,num1,num3,num2);
example : for message + value output
int num=10;
printf(“The vale of num is = %d”,num);
Syntaxes and Examples
getchar(), getche(), getch() : Standard Unformatted
Input Statement
syntax : example :
char ch;
<char_variable> = getchar(); ch = getchar();
<char_variable> = getche(); ch = getche();
<char_variable> = gethc(); ch = getch();
Here getch() & getche() are two functions which takes a character input and
doesn’t require ‘return key’ to be pressed. These functions return the
character that has been most recently typed. The ‘e’ in getche() function
means echoes (display) the character that you typed to the screen. As
against this getch() just returns the character without echoing it on the
screen. getchar() works similarly and echoes the character that you typed
on the screen but even requires enter key following the character you
typed.
Syntaxes and Examples
putchar(), putch() : Standard Unformatted
Output Statement
syntax : example :
char ch;
putchar(<char_variable>); putchar(ch);
putch(<char_variable>); putch(ch);
Here putch() & putchar() are two functions which gives a character output.
The difference between the two is that putch() doesnot translate linefeed
characters (‘n’) into carriage-return / linefeed pairs whereas putchar()
does.
Consider a situation: Output: for putch() for putchar()
printf(“RAM”); RAM RAM
putch(‘n’); or putchar(‘n’); SITA SITA
printf(“SITA”);
Task To Do – FORMULAE BASED
• WAP to perform addition on two integers.
• WAP to calculate the area of:
• Square
• Rectangle
• Triangle (with given three sides)
• WAP to calculate:
• Simple Interest
• Compound Interest
• WAP to convert temperature from:
• Fahrenheit to Celsius
• Celsius to Fahrenheit
• WAP to sum ‘n’ natural numbers.
/*addition of two integers*/
#include<stdio.h>
main()
{
int val1, val2, res;
clrscr();
printf(“Enter two integer values:-”);
scanf(“%d%d”,&v1,&v2);
res = v1+ v2;
printf(“Result = %d”,res);
}
Output:
Enter two integer values:-10
20
Result = 30
/*area of square*/
#include<stdio.h>
main()
{
int s, area;
clrscr();
printf(“Enter side of a square:-”);
scanf(“%d”,&s);
area = s * s;
printf(“Area of Square = %d”,area);
}
Output:
Enter side of a square:-6
Area of Square = 36
/*area of rectangle*/
#include<stdio.h>
main()
{
int length, breadth, area;
clrscr();
printf(“Enter length of rectangle:-”);
scanf(“%d%d”,&length);
printf(“Enter breadth of rectangle:-”);
scanf(“%d”,&breadth);
area = length * breadth;
printf(“Area of Rectangle = %d”,area);
}
/*area of triangle*/
#include<stdio.h>
#include<math.h>
main()
{
int a,b,c;
float s,area;
clrscr();
printf(“Enter sides of triangle:-”);
scanf(“%d%d%d”,&a,&b,&c);
s = (a+b+c)/2.0;
area = sqrt(s*(s-a)*(s-b)*(s-c));
printf(“Area of Triangle = %f”,area);
}
Output:
Enter length of rectangle :-10
Enter breadth of rectangle :- 20
Area of Rectangle = 200
Output:
Enter sides of a triangle:-6
7
8
Area of Triangle = 20.333162
/*simple interest*/
#include<stdio.h>
main()
{
float p,r,t,si;
clrscr();
printf(“Enter P, R and T:-”);
scanf(“%f%f%f”,&p,&r,&t);
si = (p*r*t)/100;
printf(“Simple Interest = %f”,si);
}
/*compound interest*/
#include<stdio.h>
main()
{
float p,r,t,n,a,ci;
clrscr();
printf(“Enter P,R,Tand N:-”);
scanf(“%f%f%f%f”,&p,&r,&t,&n);
r = r/100;
a = p * pow((1+(r/n),(t*n));
printf(“Amount = %f”,a);
printf(“Compound Interest = %f”,ci);
}
Output:
Enter P, R and T:-10000
10.5
5
Simple Interest = 5250.000000
Output:
Enter P, R, T and N:-1000
5
5
2
Amount = 1280.084595
Simple Interest = 280.084595
/*fahrenheit to celsius conversion*/
#include<stdio.h>
main()
{
float fh,cl;
clrscr();
printf(“Enter temperature in F:-”);
scanf(“%f”,&fh);
c = (f-32)*5/9.0;
printf(“Celsius Equivalent = %f”,cl);
}
/*celsius to fahrenheit conversion*/
#include<stdio.h>
main()
{
float fh,cl;
clrscr();
printf(“Enter temperature in C:-”);
scanf(“%f”,&cl);
fh = (1.8*c + 32);
printf(“Fahrenheit Equivalent = %f”,fh);
}
Output:
Enter temperature in F:-212
Celsius Equivalent = 100.000000
Output:
Enter temperature in C:-100
Fahrenheit Equivalent = 212.000000
/*sum of ‘n’ natural numbers*/
#include<stdio.h>
main()
{
int n, sum;
clrscr();
printf(“Enter ‘n’:-”);
scanf(“%d”,&n);
sum = n*(n+1)/2;
printf(“Sum of ‘n’ natural term = %d”,sum);
}
Output:
Enter ‘n’:-11
Sum of ‘n’ natural term = 66
Till now what we have
programmed were simple
formulae based questions.
Now, we will move towards the
logical based questions.
Means there will be no more
fixed patterns for any
solutions, procedure may
differ from programmer to
programmer as per their
own logical reasoning's.
Task To Do – LOGIC BASED
• WAP to find the greater among two numbers.
• WAP to check whether the number is odd or even.
• WAP to check whether a given year is leap or not.
• WAP to add the first and last digit of any four digit
number.
• WAP to interchange two integer values.
/*greater among two numbers*/
#include<stdio.h>
main()
{
int v1,v2;
clrscr();
printf(“Enter two numbers:-”);
scanf(“%d%d”,&v1,&v2);
printf(“Greater value is :- ”);
printf((v1>v2 ? “V1” : “V2”));
}
/*check for number is odd or even*/
#include<stdio.h>
main()
{
int no;
clrscr();
printf(“Enter any number:-”);
scanf(“%d”,&no);
printf((no%2==0 ? “Even” : “Odd”));
}
Output:
Enter two values:-10 20
Greater value is:- V2
Enter two values:-25 15
Greater value is:- V1
Output:
Enter any number:-16
Even
Enter any number:-15
Odd
/*check for leap year*/
#include<stdio.h>
main()
{
int yr;
clrscr();
printf(“Enter the value of an year:-”);
scanf(“%d”,&yr);
printf( (y%100!=0 && y%4==0) ||
(y%400==0) ? “Leap Year” : “Not a
Leap Year”));
}
zzzzzzzzzzzzzzzzzzzzzz
/*sum of first and last digit of any four
digit number*/
#include<stdio.h>
main()
{
int no,fd,ld,sum;
clrscr();
printf(“Enter any four digit number:-”);
scanf(“%d”,&no);
fd = no/1000;
ld = no%10;
sum = fd + ld;
Printf(“Sum = %d”, sum);
}
6.8
Output:
Enter the value of an year:-2004
Leap Year
Enter the value of an year:-2000
Leap Year
Enter the value of an year:-1900
Not a Leap Year
Output:
Enter any four digit number:-4578
Sum = 12
/*swapping of two integer values*/
#include<stdio.h>
main()
{
int v1,v2,temp;
clrscr();
printf(“Enter two values for v1 and v2:-”);
scanf(“%d%d”,&v1,&v2);
printf(“Values before swapping: V1 = %d,V2
= %d”, v1,v2);
temp = v1;
v1 = v2;
v2 = temp;
printf(“Values after swapping: V1 = %d,V2
= %d”, v1,v2);
}
Output:
Enter two values for v1 and v2:-10 20
Values before swapping: V1 = 10, V2 = 20
Values after swapping: V1 = 20, V2 = 10
This logic using third variable
temp can be simplified without
using it.
Logic 1: using +,-
v1=v1+v2;
v2=v1-v2;
v1=v1-v2;
Logic 2: using *,/
v1=v1*v2;
v2=v1/v2;
v1=v1/v2;
Logic 2: using ^
v1=v1^v2;
v2=v1^v2;
v1=v1^v2;
V1 V2
10 20
30 20
30 10
20 10
V1 V2
10 20
200 20
200 10
20 10
V1 V2
10 20
30 20
30 10
20 10
END OF MODULE TWO
Send your feedback/queries at
abhisheksinha786@gmail.com

More Related Content

PPSX
Programming in C [Module One]
PPT
Input And Output
PPTX
Input Output Management In C Programming
PPTX
Input output statement in C
PPTX
What is c
PPTX
Basic Input and Output
PDF
7. input and output functions
PPT
CPU INPUT OUTPUT
Programming in C [Module One]
Input And Output
Input Output Management In C Programming
Input output statement in C
What is c
Basic Input and Output
7. input and output functions
CPU INPUT OUTPUT

What's hot (20)

PPTX
Data Input and Output
PPT
Mesics lecture 5 input – output in ‘c’
PPTX
Managing input and output operations in c
PPTX
C programming(Part 1)
PDF
C programming Workshop
PPTX
Introduction to Basic C programming 02
PPTX
Programming in C (part 2)
PPTX
COM1407: Input/ Output Functions
PPTX
Introduction to C programming
PPT
Operators in C Programming
PPTX
C introduction by thooyavan
PPTX
C programming(part 3)
PDF
1 introducing c language
PPTX
Expressions using operator in c
DOCX
Important C program of Balagurusamy Book
PPTX
C Programming Language Part 6
PPTX
Decision making and branching
PDF
7 functions
Data Input and Output
Mesics lecture 5 input – output in ‘c’
Managing input and output operations in c
C programming(Part 1)
C programming Workshop
Introduction to Basic C programming 02
Programming in C (part 2)
COM1407: Input/ Output Functions
Introduction to C programming
Operators in C Programming
C introduction by thooyavan
C programming(part 3)
1 introducing c language
Expressions using operator in c
Important C program of Balagurusamy Book
C Programming Language Part 6
Decision making and branching
7 functions
Ad

Similar to Concepts of C [Module 2] (20)

PPTX
CHAPTER 4
PPT
Unit 5 Foc
DOCX
UNIT-II CP DOC.docx
PPTX
Input Output function in c programing language.pptx
PPT
Fundamental of C Programming Language and Basic Input/Output Function
PDF
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
PDF
Introduction to Input/Output Functions in C
PDF
Introduction to Computer and Programing - Lecture 04
PDF
Lec14-CS110 Computational Engineering
DOCX
string , pointer
PDF
First c program
PPTX
Chap 2 input output dti2143
PPT
input
PPTX
Input and Output In C Language
DOCX
Best C Programming Solution
PPTX
20220823094225_PPT02-Formatted Input and Output.pptx
PPT
Unit2 C
PPT
Unit2 C
PPTX
3. chapter ii
DOCX
C Programming
CHAPTER 4
Unit 5 Foc
UNIT-II CP DOC.docx
Input Output function in c programing language.pptx
Fundamental of C Programming Language and Basic Input/Output Function
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
Introduction to Input/Output Functions in C
Introduction to Computer and Programing - Lecture 04
Lec14-CS110 Computational Engineering
string , pointer
First c program
Chap 2 input output dti2143
input
Input and Output In C Language
Best C Programming Solution
20220823094225_PPT02-Formatted Input and Output.pptx
Unit2 C
Unit2 C
3. chapter ii
C Programming
Ad

Recently uploaded (20)

PPTX
Lesson notes of climatology university.
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Trump Administration's workforce development strategy
PDF
A systematic review of self-coping strategies used by university students to ...
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
RMMM.pdf make it easy to upload and study
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Lesson notes of climatology university.
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Microbial diseases, their pathogenesis and prophylaxis
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
Microbial disease of the cardiovascular and lymphatic systems
Chinmaya Tiranga quiz Grand Finale.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Trump Administration's workforce development strategy
A systematic review of self-coping strategies used by university students to ...
Orientation - ARALprogram of Deped to the Parents.pptx
RMMM.pdf make it easy to upload and study
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Computing-Curriculum for Schools in Ghana
VCE English Exam - Section C Student Revision Booklet
Weekly quiz Compilation Jan -July 25.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf

Concepts of C [Module 2]

  • 1. Introduction to ‘C’ Module 2.1 Compiled By : Abhishek Sinha (MBA-IT, MCA) Director – Academics Concept Institute of Technology, Varanasi. Website: www.conceptvns.org
  • 2. Standard I/O Statements What is an I/O statement? Those statements which read data entered through standard input device and display the values on standard output device.
  • 3. Types of Standard I/O Statement Formatted I/O Statement Unformatted I/O Statement Input Output Input Output scanf() printf() getchar() putchar() getche() putch() getch() gets() puts() All these statements are stored in <stdio.h> header file. Formatted Statements are those statements which facilitate the programmer to perform I/O operations in all type of data type available in C, whereas in Unformatted Statements, I/O operations can be performed in fixed format (date type).
  • 4. Syntaxes and Examples scanf() : Standard Formatted Input Statement syntax : scanf(“<Format String>”,&<variable_name>) or <Control String> or <Format Specifier> example : for single value input int num; scanf(“%d”,&num); example : for multiple value input int num1, num2; float num3; scanf(“%d%f%d”,&num1,&num3,&num2); The use of scanf() statement provides interactivity and makes the program user friendly.
  • 5. Syntaxes and Examples printf() : Standard Formatted Output Statement syntax : printf(“<Format String>”,<variable_name>) or <Control String> or <Format Specifier> example : for single value output int num=10; printf(“%d”,num); example : for multiple value output int num1=10, num2=20; float num3=30.5; printf(“%d%f%d”,num1,num3,num2); example : for message + value output int num=10; printf(“The vale of num is = %d”,num);
  • 6. Syntaxes and Examples getchar(), getche(), getch() : Standard Unformatted Input Statement syntax : example : char ch; <char_variable> = getchar(); ch = getchar(); <char_variable> = getche(); ch = getche(); <char_variable> = gethc(); ch = getch(); Here getch() & getche() are two functions which takes a character input and doesn’t require ‘return key’ to be pressed. These functions return the character that has been most recently typed. The ‘e’ in getche() function means echoes (display) the character that you typed to the screen. As against this getch() just returns the character without echoing it on the screen. getchar() works similarly and echoes the character that you typed on the screen but even requires enter key following the character you typed.
  • 7. Syntaxes and Examples putchar(), putch() : Standard Unformatted Output Statement syntax : example : char ch; putchar(<char_variable>); putchar(ch); putch(<char_variable>); putch(ch); Here putch() & putchar() are two functions which gives a character output. The difference between the two is that putch() doesnot translate linefeed characters (‘n’) into carriage-return / linefeed pairs whereas putchar() does. Consider a situation: Output: for putch() for putchar() printf(“RAM”); RAM RAM putch(‘n’); or putchar(‘n’); SITA SITA printf(“SITA”);
  • 8. Task To Do – FORMULAE BASED • WAP to perform addition on two integers. • WAP to calculate the area of: • Square • Rectangle • Triangle (with given three sides) • WAP to calculate: • Simple Interest • Compound Interest • WAP to convert temperature from: • Fahrenheit to Celsius • Celsius to Fahrenheit • WAP to sum ‘n’ natural numbers.
  • 9. /*addition of two integers*/ #include<stdio.h> main() { int val1, val2, res; clrscr(); printf(“Enter two integer values:-”); scanf(“%d%d”,&v1,&v2); res = v1+ v2; printf(“Result = %d”,res); } Output: Enter two integer values:-10 20 Result = 30 /*area of square*/ #include<stdio.h> main() { int s, area; clrscr(); printf(“Enter side of a square:-”); scanf(“%d”,&s); area = s * s; printf(“Area of Square = %d”,area); } Output: Enter side of a square:-6 Area of Square = 36
  • 10. /*area of rectangle*/ #include<stdio.h> main() { int length, breadth, area; clrscr(); printf(“Enter length of rectangle:-”); scanf(“%d%d”,&length); printf(“Enter breadth of rectangle:-”); scanf(“%d”,&breadth); area = length * breadth; printf(“Area of Rectangle = %d”,area); } /*area of triangle*/ #include<stdio.h> #include<math.h> main() { int a,b,c; float s,area; clrscr(); printf(“Enter sides of triangle:-”); scanf(“%d%d%d”,&a,&b,&c); s = (a+b+c)/2.0; area = sqrt(s*(s-a)*(s-b)*(s-c)); printf(“Area of Triangle = %f”,area); } Output: Enter length of rectangle :-10 Enter breadth of rectangle :- 20 Area of Rectangle = 200 Output: Enter sides of a triangle:-6 7 8 Area of Triangle = 20.333162
  • 11. /*simple interest*/ #include<stdio.h> main() { float p,r,t,si; clrscr(); printf(“Enter P, R and T:-”); scanf(“%f%f%f”,&p,&r,&t); si = (p*r*t)/100; printf(“Simple Interest = %f”,si); } /*compound interest*/ #include<stdio.h> main() { float p,r,t,n,a,ci; clrscr(); printf(“Enter P,R,Tand N:-”); scanf(“%f%f%f%f”,&p,&r,&t,&n); r = r/100; a = p * pow((1+(r/n),(t*n)); printf(“Amount = %f”,a); printf(“Compound Interest = %f”,ci); } Output: Enter P, R and T:-10000 10.5 5 Simple Interest = 5250.000000 Output: Enter P, R, T and N:-1000 5 5 2 Amount = 1280.084595 Simple Interest = 280.084595
  • 12. /*fahrenheit to celsius conversion*/ #include<stdio.h> main() { float fh,cl; clrscr(); printf(“Enter temperature in F:-”); scanf(“%f”,&fh); c = (f-32)*5/9.0; printf(“Celsius Equivalent = %f”,cl); } /*celsius to fahrenheit conversion*/ #include<stdio.h> main() { float fh,cl; clrscr(); printf(“Enter temperature in C:-”); scanf(“%f”,&cl); fh = (1.8*c + 32); printf(“Fahrenheit Equivalent = %f”,fh); } Output: Enter temperature in F:-212 Celsius Equivalent = 100.000000 Output: Enter temperature in C:-100 Fahrenheit Equivalent = 212.000000
  • 13. /*sum of ‘n’ natural numbers*/ #include<stdio.h> main() { int n, sum; clrscr(); printf(“Enter ‘n’:-”); scanf(“%d”,&n); sum = n*(n+1)/2; printf(“Sum of ‘n’ natural term = %d”,sum); } Output: Enter ‘n’:-11 Sum of ‘n’ natural term = 66 Till now what we have programmed were simple formulae based questions. Now, we will move towards the logical based questions. Means there will be no more fixed patterns for any solutions, procedure may differ from programmer to programmer as per their own logical reasoning's.
  • 14. Task To Do – LOGIC BASED • WAP to find the greater among two numbers. • WAP to check whether the number is odd or even. • WAP to check whether a given year is leap or not. • WAP to add the first and last digit of any four digit number. • WAP to interchange two integer values.
  • 15. /*greater among two numbers*/ #include<stdio.h> main() { int v1,v2; clrscr(); printf(“Enter two numbers:-”); scanf(“%d%d”,&v1,&v2); printf(“Greater value is :- ”); printf((v1>v2 ? “V1” : “V2”)); } /*check for number is odd or even*/ #include<stdio.h> main() { int no; clrscr(); printf(“Enter any number:-”); scanf(“%d”,&no); printf((no%2==0 ? “Even” : “Odd”)); } Output: Enter two values:-10 20 Greater value is:- V2 Enter two values:-25 15 Greater value is:- V1 Output: Enter any number:-16 Even Enter any number:-15 Odd
  • 16. /*check for leap year*/ #include<stdio.h> main() { int yr; clrscr(); printf(“Enter the value of an year:-”); scanf(“%d”,&yr); printf( (y%100!=0 && y%4==0) || (y%400==0) ? “Leap Year” : “Not a Leap Year”)); } zzzzzzzzzzzzzzzzzzzzzz /*sum of first and last digit of any four digit number*/ #include<stdio.h> main() { int no,fd,ld,sum; clrscr(); printf(“Enter any four digit number:-”); scanf(“%d”,&no); fd = no/1000; ld = no%10; sum = fd + ld; Printf(“Sum = %d”, sum); } 6.8 Output: Enter the value of an year:-2004 Leap Year Enter the value of an year:-2000 Leap Year Enter the value of an year:-1900 Not a Leap Year Output: Enter any four digit number:-4578 Sum = 12
  • 17. /*swapping of two integer values*/ #include<stdio.h> main() { int v1,v2,temp; clrscr(); printf(“Enter two values for v1 and v2:-”); scanf(“%d%d”,&v1,&v2); printf(“Values before swapping: V1 = %d,V2 = %d”, v1,v2); temp = v1; v1 = v2; v2 = temp; printf(“Values after swapping: V1 = %d,V2 = %d”, v1,v2); } Output: Enter two values for v1 and v2:-10 20 Values before swapping: V1 = 10, V2 = 20 Values after swapping: V1 = 20, V2 = 10 This logic using third variable temp can be simplified without using it. Logic 1: using +,- v1=v1+v2; v2=v1-v2; v1=v1-v2; Logic 2: using *,/ v1=v1*v2; v2=v1/v2; v1=v1/v2; Logic 2: using ^ v1=v1^v2; v2=v1^v2; v1=v1^v2; V1 V2 10 20 30 20 30 10 20 10 V1 V2 10 20 200 20 200 10 20 10 V1 V2 10 20 30 20 30 10 20 10
  • 18. END OF MODULE TWO Send your feedback/queries at [email protected]