import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*
<applet code="prime.class" width="500" height="600">
</applet>
*/
public class prime extends Applet implements ActionListener
{
Label lbl1;
TextField txt1,txt2;
Button btn1;
public void init()
{
lbl1=new Label("Enter any Number : ");
txt1=new TextField(20);
txt2=new TextField(20);
btn1=new Button("Check");
setLayout(null);
txt2.setBounds(130,50,200,20);
add(txt2);
txt1.setBounds(230,100,120,20);
add(txt1);
lbl1.setBounds(100,100,120,20);
add(lbl1);
btn1.setBounds(100,120,40,20);
add(btn1);
btn1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String num1=txt1.getText();
int i;
int k=0;
int num;
String str1="Prime no.";
String str2="Not Prime no.";
num=Integer.parseInt(num1);
for(i=1;i<=num;i++)
{
if(num%i==0)
{
k++;
}
}
if(ae.getSource()==btn1)
{
if(k==2)
{
txt2.setText(str1);
}
else
{
txt2.setText(str2);
}
}
}
}
import java.awt.*;
import java.awt.event.*;
/*
<applet code="prime.class" width="500" height="600">
</applet>
*/
public class prime extends Applet implements ActionListener
{
Label lbl1;
TextField txt1,txt2;
Button btn1;
public void init()
{
lbl1=new Label("Enter any Number : ");
txt1=new TextField(20);
txt2=new TextField(20);
btn1=new Button("Check");
setLayout(null);
txt2.setBounds(130,50,200,20);
add(txt2);
txt1.setBounds(230,100,120,20);
add(txt1);
lbl1.setBounds(100,100,120,20);
add(lbl1);
btn1.setBounds(100,120,40,20);
add(btn1);
btn1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String num1=txt1.getText();
int i;
int k=0;
int num;
String str1="Prime no.";
String str2="Not Prime no.";
num=Integer.parseInt(num1);
for(i=1;i<=num;i++)
{
if(num%i==0)
{
k++;
}
}
if(ae.getSource()==btn1)
{
if(k==2)
{
txt2.setText(str1);
}
else
{
txt2.setText(str2);
}
}
}
}
That was a great message in my carrier, and It's wonderful commands like mind relaxes with understand words of knowledge by information's.
ReplyDeleteDevops Training courses
python Training in chennai
Devops Training in Bangalore
After reading this web site I am very satisfied simply because this site is providing comprehensive knowledge for you to audience.
ReplyDeleteThank you to the perform as well as discuss anything incredibly important in my opinion. We loose time waiting for your next article writing in addition to I beg one to get back to pay a visit to our website in
selenium training in Bangalore
selenium training in Marathahalli
selenium training in Btm layout
selenium training in Jaya nagar
selenium training in Electronic city
selenium training in Kalyan nagar
Appreciating the persistence you put into your blog and detailed information you provide
ReplyDeletePython Online training
python Course institute in Chennai
Python Course institute in Bangalore
I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
ReplyDeletepython training in chennai
Python Online training in usa
python course institute in chennai
I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.keep it up!!
ReplyDeleteandroid training in chennai
android online training in chennai
android training in bangalore
android training in hyderabad
android Training in coimbatore
android training
android online training
Can you please share output of this program
ReplyDeleteI need to write it in my assignment..
ReplyDeleteAwesome blog. Thanks for sharing such a worthy information....
ReplyDeleteTop five reasons to Hire Java Developers
Five Reasons to Hire Java Developers
This post is so interactive and informative.keep update more information...
ReplyDeleteDigital Marketing Course in Tambaram
Digital Marketing Course in Chennai