Click here to Skip to main content
15,887,350 members
Home / Discussions / Java
   

Java

 
AnswerRe: Simple Mathematics. Pin
PIEBALDconsult3-Feb-15 7:36
mvePIEBALDconsult3-Feb-15 7:36 
GeneralRe: Simple Mathematics. Pin
hansoctantan3-Feb-15 7:48
professionalhansoctantan3-Feb-15 7:48 
GeneralRe: Simple Mathematics. Pin
PIEBALDconsult3-Feb-15 7:51
mvePIEBALDconsult3-Feb-15 7:51 
GeneralRe: Simple Mathematics. Pin
hansoctantan3-Feb-15 7:57
professionalhansoctantan3-Feb-15 7:57 
QuestionMax,Min,Average Pin
PinkPrint30-Jan-15 14:29
PinkPrint30-Jan-15 14:29 
SuggestionRe: Max,Min,Average Pin
Richard MacCutchan30-Jan-15 21:53
mveRichard MacCutchan30-Jan-15 21:53 
GeneralRe: Max,Min,Average Pin
Ravi Bhavnani31-Jan-15 5:36
professionalRavi Bhavnani31-Jan-15 5:36 
GeneralRe: Max,Min,Average Pin
PinkPrint31-Jan-15 5:50
PinkPrint31-Jan-15 5:50 
C#
public static void main(String[] args) {



        Scanner in=new Scanner(System.in);

    System.out.println("Enter a positive integer");
       int userinput=in.nextInt();
       int maxer=0;
        int miner=0;
       int sum=0;
       int counter=1;

       if(maxer<userinput){
           maxer=userinput;
           counter++;
           sum=sum+userinput;
       }
       if(miner>userinput){
           miner=userinput;
           counter++;
           sum=sum+userinput;
       }

       int avg= sum/counter;
       System.out.println("Your maximum integer is "+maxer);
       System.out.println("Your minimum integer is "+miner);
       System.out.println("Your average is "+avg);

    }
}


This is my code hereConfused | :confused:
GeneralRe: Max,Min,Average Pin
Ravi Bhavnani31-Jan-15 5:58
professionalRavi Bhavnani31-Jan-15 5:58 
GeneralRe: Max,Min,Average Pin
PinkPrint31-Jan-15 6:02
PinkPrint31-Jan-15 6:02 
GeneralRe: Max,Min,Average Pin
Richard MacCutchan31-Jan-15 6:11
mveRichard MacCutchan31-Jan-15 6:11 
AnswerRe: Max,Min,Average Pin
Akash gods6-Feb-15 7:02
professionalAkash gods6-Feb-15 7:02 
AnswerRe: Max,Min,Average Pin
Akash gods6-Feb-15 21:43
professionalAkash gods6-Feb-15 21:43 
QuestionJComponent cannot be resolved to a type Pin
Member 1141271229-Jan-15 8:10
Member 1141271229-Jan-15 8:10 
SuggestionRe: JComponent cannot be resolved to a type Pin
Richard MacCutchan29-Jan-15 23:06
mveRichard MacCutchan29-Jan-15 23:06 
AnswerRe: JComponent cannot be resolved to a type Pin
TorstenH.30-Jan-15 2:08
TorstenH.30-Jan-15 2:08 
QuestionDesigning persistence layer for java application Pin
vaibhavndave23-Jan-15 7:46
vaibhavndave23-Jan-15 7:46 
AnswerRe: Designing persistence layer for java application Pin
TorstenH.27-Jan-15 21:22
TorstenH.27-Jan-15 21:22 
QuestionJCheckBox working with check boxes inside of JTable Pin
Member 1114435719-Jan-15 6:20
Member 1114435719-Jan-15 6:20 
AnswerRe: JCheckBox working with check boxes inside of JTable Pin
TorstenH.22-Jan-15 20:31
TorstenH.22-Jan-15 20:31 
GeneralRe: JCheckBox working with check boxes inside of JTable Pin
Member 1114435729-Jan-15 1:51
Member 1114435729-Jan-15 1:51 
QuestionHow do I add values in JTable Pin
Member 1114435716-Jan-15 4:35
Member 1114435716-Jan-15 4:35 
QuestionRe: How do I add values in JTable Pin
Richard MacCutchan16-Jan-15 4:51
mveRichard MacCutchan16-Jan-15 4:51 
AnswerRe: How do I add values in JTable Pin
Member 1114435716-Jan-15 9:17
Member 1114435716-Jan-15 9:17 
GeneralRe: How do I add values in JTable Pin
Richard MacCutchan16-Jan-15 22:30
mveRichard MacCutchan16-Jan-15 22:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.