Write a program to assign a value of 45 to a double variable and then convert it to int.

Number of replies: 31
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Md. Alif Sheakh -

public class pp3 {
public static void main(String[] args) {
double var = 45;
System.out.println("Double Variable: " +var);
System.out.println("Converting double to int...");
System.out.println("Int Variable: " +(int)var);
}
}

In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Reajul Islam Nizhum -

public class pp3 {
public static void main(String[]args)
{
double var= 6.753;

System.out.println("\n Converting double variable to int.");
System.out.println(" Int Variable:"+(int)var);
}
}

In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Md. Jahidul Islam (201-15-3368) -
public class test {
public static void main(String[] args) {
double var = 45;
System.out.println("Double Variable: " +var);
System.out.println("Converting double to int...");
System.out.println("Int Variable: " +(int)var);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Pritom Basak (201-15-3342) -
package executionsteps;


public class DoubleToInt {
public static void main(String[] args) {
double vari = 45;
System.out.println("Double Variable: " +vari);
System.out.println("Double to Int:- ");
System.out.println("Int Variable: " +(int)vari);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by MD.Abdulla-Hil-Kafi (201-15-3109) -
package Main;

public class Main {
public static void main(String[] args) {
double a;
a=45;
System.out.println("Converting \"45\" double to int= "+(int)a);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Mst.Fatematuz Zohura(201-15-3195) -
public class convert {
public static void main(String[] args) {
double n=45;
System.out.println("number = "+n);
System.out.println("Converting into int= "+(int)n);
}

}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Shakil Hossen Shawon (201-15-3562) -
public class pp3 {
public static void main(String[] args) {
double var = 45;
System.out.println("Double Variable: " +var);
System.out.println("Converting double to int...");
System.out.println("Int Variable: " +(int)var);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by MD. ASLAMUZZAMAN BAPPY (201-15-3228) -
public class oop_3 {
public static void main(String[] args) {
double var = 45;
System.out.println("Double Variable: " +var);
System.out.println("Converting double to int: ");
System.out.println("Int Variable: " +(int)var);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Sadia Sultana Chowa ( 201-15-3052 ) -
package typecast;

public class Typecast {

public static void main(String[] args) {
// TODO Auto-generated method stub
double a = 45.54 ;
int i = (int)a;
System.out.println(i);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Rahad Islam (201-15-3623) -
public class intVar {
public static void main(String[] args) {
System.out.println("The double number=45.763");
double num=45.763;
System.out.println("Int num"+(int)num);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Abdullah Fahim(201-15-3201) -
public class Practice {

public static void main(String[] args) {
double num = 45;
System.out.println("Double variable: "+num);
System.out.println("Convert then int variable is: "+(int)num);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Risul Islam Jim (201-15-3675) -
public class DoubletoInteger {

public static void main(String[] args) {
double var = 45;
System.out.println("Double Variable: " +var);
System.out.println("Converting double to integer...");
System.out.println("Int Variable: " +(int)var);

}

}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by B.M.Samiul Haque Real (201-15-3057) -
public class print {
public static void main(String[] args) {
double r = 45;
System.out.println("Double variable: "+r);
System.out.println("Int variable: "+(int)r);
}}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Shazzad Shawon (201-15-3404) -
public class Convert {
public static void main(String[] args) {
double a=45;
System.out.println("number = "+a);
System.out.print("Converting into int= /n "+(int)a);
}

}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Sadia Islam Tonni(201-15-3290) -
package beginnerjava;


public class ConverValue {
public static void main(String[] args) {
double x=45;
System.out.println("Double Value x="+x);
System.out.println("Converting double to int value = "+(int)x);
}

}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Tasnim Bill Zannah (201-15-3033) -
package javaapplication;
public class DoubleToInt {


public static void main(String[]args){
double t;
t=45;
System.out.println("The result of the conversion is:"+(int)t);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Md. Uzzal Hossain Hridoy (201-15-3078) -

public class Main
{

public static void main(String[] args)
{
double h = 45;
System.out.println("The answer is: " + (int)h);
}
}

In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Utsha Roy (201-15-3094) -
public class Prac2 {
public static void main(String[] args)

{

double b= 45;

System.out.println("The result is=" + (int)b);


}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Md. Nazmus Sakib (201-15-3419) -
public class Convert_Int
{

public static void main(String[] args)
{

double x = 45;

System.out.println("Double variable: " +x);

System.out.println("Number: ");

System.out.println("After converting to int: " +(int)x);

}

}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Shahnewaj Bin Hafiz (201-15-3049) -
public class pp3 {
public static void main(String[]args)
{
double var= 8.355;

System.out.println("\n Converting double variable to int.");
System.out.println(" Int Variable:"+(int)var);
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Mahir Hasan Sifat (201-15-3120) -
import java.io.*;
import java.util.*;

public class demo {

public static void main(String[] args) {

double val = 45.0;
System.out.println("Answer of "+ val +" to integer "+(int)val);

}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Zaky Hossain (201-15-3610) -
public class test {
public static void main(String[] args) {
double var = 45;
System.out.println("Double Variable: " +var);
System.out.println("Converting double to int...");
System.out.println("Int Variable: " +(int)var);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Tanjil Alom (201-15-3079) -
public class work {
public static void main(String[] args) {
double num = 45;
System.out.println("Double Variable: "+num);
System.out.println("Int Variable: "+(int)num);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Ieshita Nasrin Bithi (201-15-3216) -
public class Practice {
public static void main(String[] args) {
double a;
a=45;
System.out.println("Converting \"45\" double to int= "+(int)a);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Mst. Sazia Tahosin (201-15-3666) -
package typecast;

public class Typecast {

public static void main(String[] args) {
double a = 45 ;
int i = (int)a;
System.out.println(i);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Dipa Mondal Tumpa (201-15-3214) -
public class Doublevrble {

public static void main(String[] args) {
double D = 45.32 ;

System.out.println("Int Variable: " +(int)D);
}

}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Fahim Shahriar (201-15-3629) -
public class convert {
public static void main(String[] args) {
double var = 45;
System.out.println("Double Variable: " +var);
System.out.println("Converting double to int...");
System.out.println("Int Variable: " +(int)var);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Shakil Hossen Shawon (201-15-3562) -
public class pp3 {
public static void main(String[] args) {
double var = 45;
System.out.println("Double Variable: " +var);
System.out.println("Converting double to int...");
System.out.println("Int Variable: " +(int)var);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Tahmid chowdhury ID-(201-15-3064) -
public class Practice {

public static void main(String[] args) {
double num = 45;
System.out.println("Double variable: "+num);
System.out.println("Convert then int variable is: "+(int)num);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by SOHANUR RAHMAN SOHAG_201-15-3161 -
package oopbasic;

public class dbl_to_int {
public static void main(String[] args) {
double vari = 45;
System.out.println("Double Variable: " +vari);
System.out.println("Converting double to int:-");
System.out.println("Int Variable: " +(int)vari);
}
}
In reply to First post

Re: Write a program to assign a value of 45 to a double variable and then convert it to int.

by Sydul Islam Bhuiyan Ridoy (201-15-3061) -
package Main;

public class Main {
public static void main(String[] args) {
double a;
a=45;
System.out.println("Converting \"45\" double to int= "+(int)a);
}
}