Write a program to print the swapping in two no and using
three variable.

Answers were Sorted based on User's Feedback



Write a program to print the swapping in two no and using three variable...

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

Write a program to print the swapping in two no and using three variable...

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

Write a program to print the swapping in two no and using three variable...

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

Write a program to print the swapping in two no and using three variable...

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

Write a program to print the swapping in two no and using three variable...

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

Post New Answer

More STL Interview Questions

please visit this site you'll find my question this is my homework please answer it if you can http://easyscience.org/ib/lofiversion/index.php/t36168.html

0 Answers  


draw a flowchart that accepts two numbers and checks if the first is divisible by the second.

0 Answers   Appin, NIIT,


give me the defination of inheritance?

5 Answers   Infosys,


What are the different types of stl containers?

0 Answers  


HOW TO GET "H1B" -VISA 4 USA FOR MY SON?HE HAD COMPLETED "MS"(IT)FROM AUSTALIA 2007.I AM WORKING IN U.S.A.

0 Answers  






how can u do connectivity in c++ language? plz send me connectivity code in c++ ?

0 Answers   Ascent,


how to use C++?

0 Answers   NIIT,


i want a road rash 3d game code if some one know please help me

1 Answers  


what is an algorithm in terms of STL?

1 Answers   Lucent, Wipro,


What is the use of stl?

0 Answers  


What are the various types of stl containers?

0 Answers  


differentiate between private, public and protected data members of the class using example.

1 Answers  


Categories