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

Object Oriented Programming Assignment Tasks

The document outlines an Object Oriented Programming assignment with multiple tasks. It includes defining a for-loop and creating a star pattern, finding the second largest distinct element in an array, calculating the sum of numbers from 1 to 10 using a while loop, counting digits in a number using a do-while loop, and checking divisibility by 5 and 10. Each task includes input and output examples for clarity.

Uploaded by

arasankural309
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)
6 views1 page

Object Oriented Programming Assignment Tasks

The document outlines an Object Oriented Programming assignment with multiple tasks. It includes defining a for-loop and creating a star pattern, finding the second largest distinct element in an array, calculating the sum of numbers from 1 to 10 using a while loop, counting digits in a number using a do-while loop, and checking divisibility by 5 and 10. Each task includes input and output examples for clarity.

Uploaded by

arasankural309
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

Object Oriented Programming

Assignment-1

1. Define for-loop with syntax and write a program to print(alphabet


letter) A star pattern.
Input:A
Output:

**
* *
******
* *
2. Given an array of positive integers arr[] of size n,the task is to find
second largest distinct element in th array.
Note: If the second largest element does not exists,return-1.
Examples:
Input: arr[] = [12.35,1,10,34,1]
Output: 34
Explaination: The largest element of the array is 35 and the second largest
element is 34.
3. Calculating the sum of Numbers from 1 to 10 with java while loop.
[Link] number of digits in a number using do- while.
Input:5678
Output:4
[Link] whether the given number is divisible by both 5 and 10.
Input 1:20
Output:True
Input 2: 25
Output:False

You might also like