NIMTA, Kolkata, India - 700049
Top Tutor 15
Details verified of Himbanta M.✕
Identity
Education
Know how UrbanPro verifies Tutor details
Identity is verified based on matching the details uploaded by the Tutor with government databases.
Class Location
Online Classes (Video Call via UrbanPro LIVE)
Student's Home
Tutor's Home
Years of Experience in Class 6 Tuition
6
Board
CBSE, State, ICSE
State boards taught
West Bengal State Board
CBSE Subjects taught
Science, Mathematics
ICSE Subjects taught
Biology, Mathematics, Physics, Chemistry
Experience in School or College
I was a part time teacher in The Aryans for 1.5 years
Taught in School or College
Yes
State Syllabus Subjects taught
Science, Mathematics
4.8 out of 5 48 reviews
Vivek Karmakar
Class 10 Tuition
I liked
Class Content
Rimon Bhadra
Class I-V Tuition
I liked
Audio/Video Quality
Class Content
Teaching Method
Teacher's Knowledge
Saptarshi Roy
Class 9 Tuition
I loved
Audio/Video Quality
Class Content
Teaching Method
Teacher's Knowledge
Answered on 23/04/2021 Learn Tuition
#include<stdio.h>
int main()
{
int a=10, b=20;
printf("Before swap a=%d b=%d",a,b);
a=a+b;//a=30 (10+20)
b=a-b;//b=10 (30-20)
a=a-b;//a=20 (30-10)
printf("\nAfter swap a=%d b=%d",a,b);
return 0;
}
Output:
Before swap a=10 b=20
After swap a=20 b=10
Program 2: Using * and /
Let's see another example to swap two numbers using * and /.
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a=10, b=20;
printf("Before swap a=%d b=%d",a,b);
a=a*b;//a=200 (10*20)
b=a/b;//b=10 (200/20)
a=a/b;//a=20 (200/10)
system("cls");
printf("\nAfter swap a=%d b=%d",a,b);
return 0;
}
Answered on 22/04/2021 Learn Tuition
Without using any variable in C++:
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a=10, b=20;
printf("Before swap a=%d b=%d",a,b);
a=a*b;//a=200 (10*20)
b=a/b;//b=10 (200/20)
a=a/b;//a=20 (200/10)
system("cls");
printf("\nAfter swap a=%d b=%d",a,b);
return 0;
}
With using third variable:
#include<stdio.h>
int main() {
double first, second, temp;
printf("Enter first number: ");
scanf("%lf", &first);
printf("Enter second number: ");
scanf("%lf", &second);
// Value of first is assigned to temp
temp = first;
// Value of second is assigned to first
first = second;
// Value of temp (initial value of first) is assigned to second
second = temp;
printf("\nAfter swapping, firstNumber = %.2lf\n", first);
printf("After swapping, secondNumber = %.2lf", second);
return 0;
}
Share this Profile
Reply to 's review
Enter your reply*
Your reply has been successfully submitted.
Certified
The Certified badge indicates that the Tutor has received good amount of positive feedback from Students.