Java Solve the Program: Create a Series 0, 3, 8, 15, 24, 35...

  • Thread starter Thread starter Aman Gaur
  • Start date Start date
  • Tags Tags
    Program Series
AI Thread Summary
The discussion revolves around creating programs to generate specific numerical series and understanding their underlying patterns. Initially, participants focus on a series defined by the numbers 0, 3, 8, 15, 24, 35, identifying that the differences between these numbers resemble a sequence of odd numbers. A suggestion is made to implement this pattern in Java, with hints provided to simplify the understanding of the series through mathematical expressions.Participants also seek assistance with another programming task involving a specific output format of numbers. They are encouraged to explore relationships between the generated sequences and to use loops for implementation. Additionally, a more complex problem regarding income tax calculation based on employee grades and salaries is introduced. The challenge lies in calculating monthly income tax based on annual salary thresholds, with a request for clarification on how to approach this calculation given the provided salary structure. The conversation highlights the collaborative effort to solve programming challenges and the importance of understanding mathematical relationships in coding tasks.
Aman Gaur
Messages
6
Reaction score
0
can anyone help in solving this program...

write a program to create the series as 0 ,3 ,8 ,15 ,24 ,35...till n terms
 
Technology news on Phys.org
Tell us if you have discovered the "pattern" in those numbers yet? Once you know the pattern then I think the program to generate those numbers should be very easy.
 
Here's a Pari program you can convert:

Code:
seq(n)=print1(0);for(k=1,n-1,print1(" ,"if(k%6,[3,8,15,24,35][k%6],0)))

Output for seq(20):
Code:
0 ,3 ,8 ,15 ,24 ,35 ,0 ,3 ,8 ,15 ,24 ,35 ,0 ,3 ,8 ,15 ,24 ,35 ,0 ,3
 
i understood the pattern as the difference between the series is like series of odd numbers...i don't know wat r u thinking it at as...the reply u have given cannot be used in java...

can u help me to understand better...please
 
Aman Gaur said:
i understood the pattern as the difference between the series is like series of odd numbers

Yes that's good, you could certainly implement that pattern in java. Have you made any attempt to implement it yet?

There is actually an even easier pattern to those numbers (other than the "difference = increasing sequence of odd numbers" one that you've already found).

Here's a hint: What do you get when you expand and simplify the expression (n+1)^2 - n^2 and how does this relate to a sequence of increasing odd numbers?
 
i didn't get it...sorry
 
thank you sir...i got it ...as you said it...

thank you very much...

i need you help in another one like that...it says

write a program to print the following series as
55555
54444
54333
54322
54321
 
Aman Gaur said:
thank you sir...i got it ...as you said it...

thank you very much...

i need you help in another one like that...it says

write a program to print the following series as
55555
54444
54333
54322
54321

55555-54321 = ?
54444-54321 = ?
54333-54321 = ?
54322-54321 = ?
54321-54321 = ?

Find relationship

so values ...f(x) = g(x) + 54321

run a simple for loop
 
thank you sir,,,,,i am very thankful of yours to help me out in this crucial way...

thanks a lot...

u r amazing
 
  • #10
sir i just want to clarify one statement that i am not able to understand...and that is

there is question regarding incometax which we have to make a program on java


a company has employees who are divided into four grades as follows :
grade basic DA(of basic) HRA(of basic)
1 10000 or more 40% 30%
2 5000 - <10000 40% 25%
3 <5000 but >2000 30% 20%
4 <= 2000 30% 15%

this statement...

"if the net salary which is the total of BASIC ,DA ,HRA is above Rs 50,000 per month then incometax at the rate of 30 % of the annual salary exceeding Rs 50,000 is deducted on monthly basis at source."

Taking the name of the employees and the basic monthly pay as inputs , a pay slip which contains name, grade , basic monthly pay ,DA , HRA , monthly income , net monthly salary , for employee is to be printed ...write a program to perform this job..

Sir...how can we find income tax at monthly basis...? when we are given to find it at annual basis...
 
Back
Top