import java.io.*;
import java.io.DataInputStream;
class input
{
int real,img;
void read()
{
try
{
System.out.println("enter the real part");
DataInputStream in=new DataInputStream(System.in);
real=Integer.parseInt(in.readLine());
System.out.println("enter the imaginery part");
img=Integer.parseInt(in.readLine());
System.out.print("u entered:"+real);
System.out.println("+i"+img);
}
catch(Exception e)
{
}
}
void write()
{
System.out.print("the result is="+real);
System.out.println("+i"+img);
}
}
class comp
{
public static void main(String args[])
{
input ob1=new input();
input ob2=new input();
input ob3=new input();
ob1.read();
ob2.read();
ob3.real=ob1.real+ob2.real;
ob3.img=ob1.img+ob2.img;
ob3.write();
}
}
OUTPUT:
0 comments:
Post a Comment