0% found this document useful (0 votes)
29 views1 page

Assignment 2 Due: 11PM, 18 Sep 2020 Credit: 3% of The Course

IME 603 iNTRODUCTION TO Java

Uploaded by

Sumit Tripathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views1 page

Assignment 2 Due: 11PM, 18 Sep 2020 Credit: 3% of The Course

IME 603 iNTRODUCTION TO Java

Uploaded by

Sumit Tripathi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

IME Department, IIT Kanpur

IME 603, Introduction to Computing, I Sem, 2020-21

Assignment 2
Due: 11PM, 18 Sep 2020
Credit: 3% of the course

Write a class MyCheck that has the following methods.


1. A method isMultiple that takes two long values n and m and returns true if n is a multiple
of m,(that is n = m * i for some integer i).
2. A method isOdd that takes an int n and returns true if n is odd. Your method cannot use
the multiplication, modulus or division operator.
3. A method allSum that takes an integer n and returns the sum of all positive integers less
than or equal to n.
4. A method allESum that takes an integer n and returns the sum of all the even positive
integers less than or equal to n
5. A method allSqSum that takes an integer n and returns the sum of the squares of all
positive integers less than or equal to n.
Write another class containing main method that will first ask user to make a choice of the
method and then take appropriate number of inputs and display results.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy