TCS
Company
if a(N)=a(N-1)-a(N-2) where n>=3 & integer. given-a(1)=1,a(2)=1.calculate s(1000) dt ts suymn of 21st 1000 integers.
options-
2
3
4
0
Read Solution (Total 7)
-
- a(1)=1,
a(2)=1,
a(3)=0,
a(4)=-1,
a(5)=-1,
a(6)=0,
sum of all these 6 terms is = 0
and now it follow this cycle continuously upto a(996)
so sum upto a(996)=0
so [a(1)+a(2)+.....a(996)]+a(997)+a(998)+a(999)+a(1000)= [ 0 ]+1+1+0-1
so answer is = 1 NO OPTION MATCHED (but its right answer you can check it with
make a c program for it )
so summation upto - 12 years agoHelpfull: Yes(43) No(3)
- Answer is 3.
- 12 years agoHelpfull: Yes(6) No(10)
- ans is 3
see
a(1)=1
a(2)=2
a(3)=1
a(4)=-1
a(5)=-2
a(6)=-1
then again a(7)=1 a(8)=2 a(9)=1....so on
so after 6 terms pattern repeats n sum of 6 terms is 0
hence till 996 sum is 0
so,a(997) will be 1
a(998)=2 a(999)=1 a(1000)=-1
hence sum is 3
- 12 years agoHelpfull: Yes(6) No(10)
- C-PROGRAM FOR QUESTION :
#include"stdio.h"
#include"conio.h"
void main()
{
int a[2000],i,sum=0;
clrscr();
a[1]=1;a[2]=1;
for(i=3;i - 12 years agoHelpfull: Yes(3) No(0)
- @Neha
in question a(2)=1 not 2
so plz read question first
i know there is 9th 10th & 11th question of TCS openseesame are wrong so plz solve it as it given !
checkout - https://campus.tcs.com/OpenSeesame/ - 12 years agoHelpfull: Yes(2) No(0)
- #include"stdio.h"
#include"conio.h"
void main()
{ int a[2000],i,sum=0;
clrscr();
a[1]=1;a[2]=1;
for(i=3;i - 12 years agoHelpfull: Yes(0) No(0)
-
- 12 years agoHelpfull: Yes(0) No(1)
TCS Other Question