Sunday 16 August 2015

WAP in java to convert positive no into negative no and vice versa.

//Interchange sign of a no

import java.util.Scanner;


class Pos_Neg {

public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter a no:");
int n=sc.nextInt();

System.out.println("New No:"+(n*(-1)));
}


}

No comments:

Post a Comment