Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions BreakDigit.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.worksheet1;

import java.util.Scanner;

/**
*
* @author Shanmuga Priya M
*/
public class breakdigit {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int n,r,i,j;
i=0;
int a[]=new int[10];
Scanner obj= new Scanner(System.in);
n=obj.nextInt();
while(n>0){
r=n%10;
a[i]=r;
n=n/10;
i++;
}
for(j=i-1;j>=0 ;j--){
System.out.println(a[j]);
}

}

}
23 changes: 23 additions & 0 deletions RandomNumber.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.worksheet1;

/**
*
* @author Shanmuga Priya M
*/
public class randomno {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int a= (int)((Math.random()*10));
System.out.println(a);
// TODO code application logic here
}

}
34 changes: 34 additions & 0 deletions ReverseArray.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.mycompany.worksheet1;

import java.util.Scanner;

/**
*
* @author Shanmuga Priya M
*/
public class reversearray {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int a[]=new int[10];
int n,i;
Scanner obj= new Scanner(System.in);
System.out.println("enter sizr of array");
n=obj.nextInt();
System.out.println("enter elements of array");
for(i=0;i<n;i++){
a[i]=obj.nextInt();
}
for(i=n-1;i>=0;i--){
System.out.println(a[i]);
}
}

}