Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/School-Work / School Work/4.14 LAB- Middle item.java |
| Date | Not specified in source |
| Repository | Janady13/School-Work |
| Revision | 4a666c890caf7c43c47d0572dbcc287373c7a78e |
| Branch | main |
| Path or archive member | School Work/4.14 LAB- Middle item.java |
| Original SHA-256 | c5a8289e87db43ec877e772bd18432a30bd776f39fe11c3f3cb4ffa325a3ce60 |
| Git blob SHA | cc7cac347c99c6bf77ca46b150f32db5f69ea603 |
| Reading-copy SHA-256 | c5a8289e87db43ec877e772bd18432a30bd776f39fe11c3f3cb4ffa325a3ce60 |
Every recorded occurrence
These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/School-Work / School Work/4.14 LAB- Middle item.java | main | 4a666c890caf7c43c47d0572dbcc287373c7a78e | Open original |
| Janady13/School-Work / School Work/School-Work/School Work/4.14 LAB- Middle item.java | main | 4a666c890caf7c43c47d0572dbcc287373c7a78e | Open original |
Recovered source transcript
Download complete source text ↓36 lines · 0.9 KB
import java.util.Scanner;
public class LabProgram
{
public static void main(String[] args) {
Scanner scnr=new Scanner(System.in);
int[] userValues=new int[9];//set of data specified by user
//declare variables
int i=0;
int input=0;
int middle;
//this loop take input untill user not enter negative value
while(input>=0)
{
if(i<9)//maximum number of inputs is 9
{
//get input
input=scnr.nextInt();
if(input<0)//if input is negative break the loop
{
break;
}
userValues[i]=input;//otherwise input store in array
i++;
}
else//if number of input exceeds give message and exit
{
System.out.println("Too many numbers");
System.exit(0);
}
}
//calculate middle element
middle=userValues[i/2];
//print Middle element
System.out.println("Middle item: "+middle);
}
}