Professional Documents
Culture Documents
HW2W
import javax.swing.*;
public class HW2W
{
public static void main(String[] args)
{String s=""; String
ab;
ab=JOptionPane.showInputDialog("say giriniz");
int x=1; int y=1;
int n;
n=Integer.parseInt(ab);
while(x<=n) {y*=x;
x++;} s+=+y;
JOptionPane.showMessageDialog(null,s," FAKTRYEL SONUCU",JOptionPane.PLAIN_MESSAGE);
}}
HW2F
import javax.swing.*;
public class HW2F
{
public static void main(String[] args)
{String s=""; String
ab;
ab=JOptionPane.showInputDialog("say giriniz");
int y=1;
int n;
n=Integer.parseInt(ab); for(int
x=1;x<=n;x++)
{y*=x;}
s+=+y;
JOptionPane.showMessageDialog(null,s,"FAKTRYEL SONUCU",JOptionPane.PLAIN_MESSAGE);
}
}
HW3
import javax.swing.*;
public class HW3
{
public static void main(String[] args)
{
String s="";
double y=0;
double i=1.0; int
k=1;
while(i<=25000)
{y+=k*4/(2*i-1) ;
i++; k*=-1;
}
s+=+y;
JOptionPane.showMessageDialog(null,s,"P SAYISI",JOptionPane.PLAIN_MESSAGE);
}
}
HW4