// this programs swaps the values of two variables a and b by using a third variable c;
public class swap
{
public static void main(String[] args)
{
int a,b,c;
a=5;
b=3;
c=a;
a=b;
b=c;
System.out.print("a = "+a);
System.out.println("b = "+b);
}
}
public class swap
{
public static void main(String[] args)
{
int a,b,c;
a=5;
b=3;
c=a;
a=b;
b=c;
System.out.print("a = "+a);
System.out.println("b = "+b);
}
}
output:
a=3
b=5
No comments:
Post a Comment
SAY HELLO!!