Write a program to print the swapping in two no and using
three variable.
Answers were Sorted based on User's Feedback
Answer / guest
int a=10,b=20;
a=a+b;
b=a-b;
a=a-b;
S.o.pln(a);
S.o.pln(b);
Is This Answer Correct ? | 17 Yes | 4 No |
Answer / saiteja gangisetty
#include<stdio.h>
void main()
{
int a,b,temp;
printf("enter a, b values");
scanf("%d%d",a,b);
temp=a;
a=b; (or) // b=a*b/a=b;
b=temp;
printf("a=%d and b=%d",a,b);
}
Is This Answer Correct ? | 7 Yes | 0 No |
Answer / anshuman jha
#include<iostream.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
cout<<"Enter the two different no :";
cin>>a>>b;
cout<<"After swapping :"<<a<<b;
c=a;
a=b;
b=c;
cout<<"Before swapping :"<<a<<b;
getch();
}
Is This Answer Correct ? | 9 Yes | 4 No |
Answer / manasa bugude
import java.util.Scanner;
public class SwappMethod {
public static void main(String[] args)
{
int a,b,c,d;
Scanner scn=new Scanner(System.in);
System.out.println("enter the value of a,b and c");
a=scn.nextInt();
b=scn.nextInt();
c=scn.nextInt();
System.out.println("before swapping numbers:"+a+" "+b+" "+c);
d=a;
a=b;
b=c;
c=d;
System.out.println("after swapping number:"+a+" "+b+" "+c);
System.out.println();
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / anonymous
import java.util.*;
class S3v
{
public static void main(String args[])
{
int a,b,c;
Scanner s=new Scanner(System.in);
a=s.nextInt();
b=s.nextInt();
c=a-b;
a=a-c;
b=b+c;
System.out.print(a+" "+b);
}
}
Is This Answer Correct ? | 0 Yes | 0 No |
write a c++ program to create an object of a class called employee containing the employee code name designation basic salarry HRA Da gross salary as data 10 such objects "members process "
How the STL's are implemented, What the difference between templates and STL?
if x<>=z then statement end what is the cyclomatic complexity
write a program to demonstrate,how constructor and deconstructor work under multilevel inheritance
What is stl stack?
help me i need a c++ program which takes sequesnce of characters and outputed sequence of their token taypes, work same compiler in lexical analysis phase
WHAT IS THE DIFFERENCE BETWEEN C++ AND VC++
How does an stl file work?
Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.
How is stl different from c++ standard library?
write a c++ to define a class box with length,breadth and height as data member and input value(),printvalue() and volume() as member functions.
What are the components of stl?