Program
import java.lang.Math;
class b4
{
public static void main (String[] args) {
double a=56.34;
double y=Math.sin(a);
System.out.printf("The sin value of %f is %f",a,y);
}
}
Output
The sin value of 56.340000 is -0.207157
class b4
{
public static void main (String[] args) {
double a=56.34;
double y=Math.sin(a);
System.out.printf("The sin value of %f is %f",a,y);
}
}
Output
The sin value of 56.340000 is -0.207157
Program
class it{
public static void main (String[] args) {
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
System.out.printf("% d\t",i);
System.out.printf("\n");
}
}
}
Output
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
import java.lang.Math;
class b1
{
public static void main (String[] args) {
double a=56.34;
double y=Math.sqrt(a);
System.out.printf("The Square Root of %f is %f",a,y);
}
}
Output
The Square Root of 56.340000 is 7.505998
public static void main (String[] args) {
int i,j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
System.out.printf("% d\t",i);
System.out.printf("\n");
}
}
}
Output
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5
Fibonaci
class fibonaci{
public static void main (String[] args) {
int n,m=100,x,y;
n=0; x=1;
System.out.printf("%d\t",x);
while(x<=m)
{
y=n+x;
System.out.printf("% d\t",y);
n=x; x=y;
}
}
}
Output
1 1 2 3 5 8.........
public static void main (String[] args) {
int n,m=100,x,y;
n=0; x=1;
System.out.printf("%d\t",x);
while(x<=m)
{
y=n+x;
System.out.printf("% d\t",y);
n=x; x=y;
}
}
}
Output
1 1 2 3 5 8.........
Fahrenheit to Celsius
import java.util.Scanner;
class f
{
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
float F;
float C;
System.out.println("Enter a number");
F = input.nextInt();
C=(F-32)/18;
System.out.printf("Converted Celsius Heat is %.2f",C);
}
}
Output
Enter a number
420
Converted Celsius Heat is 21.56
class f
{
public static void main (String[] args) {
Scanner input = new Scanner(System.in);
float F;
float C;
System.out.println("Enter a number");
F = input.nextInt();
C=(F-32)/18;
System.out.printf("Converted Celsius Heat is %.2f",C);
}
}
Output
Enter a number
420
Converted Celsius Heat is 21.56
Program
import java.lang.Math;
class b1
{
public static void main (String[] args) {
double a=56.34;
double y=Math.sqrt(a);
System.out.printf("The Square Root of %f is %f",a,y);
}
}
Output
The Square Root of 56.340000 is 7.505998
No comments:
Post a Comment