Taking an integer n, divide n by 2 if n is even or multiply by 3 and add 1 if n is odd, repeat the process until n = 1

 


import java.util.Scanner;

public class Main{
public static void main(String args []){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the number");
int i = sc.nextInt();
while(i != 1){
if(i%2 == 0){
i = i/2;
} else{
i = (i*3 + 1)/2;
}
}
System.out.println("Updated value of entered number is :"+i);
}

}

Google Script for Data Entry Form in Google Spreadsheet

// function to validate the entry made by user in user form function validateEntry (){ // declare a variable and referernece of active goog...