import java.io.*;
/**
* Write a description of class ewanq here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class input1
{
public static void main (String [] args)throws Exception
{
BufferedReader input = new BufferedReader (new InputStreamReader(System.in));
clear_string c = new clear_string();
c.clear_string();
int n;
String strnum1;
System.out.print("Enter value");
strnum1= input.readLine();
n = Integer.parseInt(strnum1);
System.out.print( n + " ");
while (n!=1)
{
if (n%2==1)
{
n=(3*n)+1;
System.out.print(n + " ");
}
else
{
n =n/2;
System.out.print(n + " ");
}
}
}
}
how can i get the length of this input..thanks for the fast responds
function..joexce January 1, 2012 at 2:18 PM
i have problem with java function,like length() i don't know how much function in java can you tell me about it ?
functionjoexce January 1, 2012 at 2:21 PM
i have problem with function in java, i dont know how much function like length() etc can you tell me about it? i need reference from java,please
how i can get the length in this inputceasar February 24, 2012 at 2:29 PM
import java.io.*; /** * Write a description of class ewanq here. * * @author (your name) * @version (a version number or a date) */ public class input1 { public static void main (String [] args)throws Exception { BufferedReader input = new BufferedReader (new InputStreamReader(System.in)); clear_string c = new clear_string(); c.clear_string(); int n; String strnum1; System.out.print("Enter value"); strnum1= input.readLine(); n = Integer.parseInt(strnum1); System.out.print( n + " "); while (n!=1) { if (n%2==1) { n=(3*n)+1; System.out.print(n + " "); } else { n =n/2; System.out.print(n + " "); } } } } how can i get the length of this input..thanks for the fast responds
javasachin sharma March 16, 2012 at 11:24 AM
How to run package
Post your Comment