Computer Science, asked by ravishashoo, 1 year ago

Write the program to generate the following series
i 1,4,9,16,25------------------------------ up to 10 terms
ii 2,9,28,65,126,--------------------------up to 10 terms


ritzdas: May I know what type of program you want?
ravishashoo: qbasic
ritzdas: ok wait..i will answer in a while..
ravishashoo: please answer as soon as possible
ravishashoo: please ans correctely

Answers

Answered by ritzdas
24
i) 10 for i = 1 to 10 
   20 print i * i 
   30 next i 
---------------------
ii) The logic used for next problem is
1^3+1=2
2^3+1=9
3^3+1=28
4^3+1=65
5^3+1=126
6^3+1=217
7^3+1=344
8^3+1=513
9^3+1=730
10^3+1=1001




ravishashoo: can you please try
ravishashoo: please
ritzdas: sorry I am not able to do this program
ravishashoo: ohk  its ok
ravishashoo: can you do this one
ritzdas: no sorry
ravishashoo: to find the sum of squares of odd number up to 10
ravishashoo: write the program
ravishashoo: its also of qbasic
ravishashoo: please answer me please 
Answered by prakriti27
10
i)
class Pattern
{
void main()
{
for(int i=1; i<=10; i++)
{
System.out.println(Math.pow(i,2));
}
}
}

ii)
class Pattern
{
void main()
{
for(int i=1; i<=10; i++)
{
System.out.println(Math.pow(i,3)+1);
}
}
}
Similar questions