The Artima Developer Community
Sponsored Link

Java Answers Forum
small answers

1 reply on 1 page. Most recent reply: Feb 27, 2006 11:30 PM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
waaa waaa

Posts: 1
Nickname: waaa
Registered: Feb, 2006

small answers Posted: Feb 27, 2006 12:13 PM
Reply to this message Reply
Advertisement
I need some small answers for these Q..

-how can I write a java program to read a number from the KB then print the sum of the digits of that number.

-input an integer then outputs the number with the digits reversed

-asks the user to enter a number 'k' and then find the sum of squares of the first 'k' positive integers


-read a set of integers and then prints the number of odd and even integers it sould also output the Zero

the last one
-read aset of integers to an array and then output the largest number in the set


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: small answers Posted: Feb 27, 2006 11:30 PM
Reply to this message Reply
Input: Use System.read()
Output: System.println()
Invert: Convert number to string, then read the characters with a loop backwards and add them to a new String.
Sum of squares: This is simpliest maths. A loop, a multiplication and an addition should do the trick
Max Number: A loo and Math.max() should be anything you need.


At least TRY to do your homework for yourself.

Flat View: This topic has 1 reply on 1 page
Topic: JNI Previous Topic   Next Topic Topic: error:stringindexoutofbounds, please help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use