Computer Science, asked by pushkarverma548, 1 month ago

1 Write a statement to store 45.6 in a variable : y . Accepted from the user

Answers

Answered by AbhishekGudasi
1

Answer:

flot y=45.6 use this one in c language

Answered by poojan
14

Statement for accepting 45.6 as input from the user and storing it into variable y:

float y = sc.nextFloat();

/*Where sc is a scanner variable*/

/*45.6 is accepted as input from the user*/

Complete Program:

import java.util.*;

public class Sample

{

   public static void main ( String args[] )

   {

        Scanner sc = new Scanner(System.in);

        float y = sc.nextFloat();

        System.out.println(y);

   }

}

Input by user:

45.6

Output:

45.6

Learn more:

Write a program to check whether it is a Lead number or not in java

https://brainly.in/question/15644815

Write a program in Java to generate the following pattern using nested loops.

https://brainly.in/question/15644815

Similar questions