Ques12-Write A Program To Find The Sum of Series: - S 1 + A + A A + A A A+ .10 Power
Ques12-Write A Program To Find The Sum of Series: - S 1 + A + A A + A A A+ .10 Power
Algorithm-
which sends i to
power of a and sum is
stored in s
}
3. Sum is displayed.
System.out.println(c);
a=b;
b=c;
n=n+1;
}
while(n<=10); }}
8. Stop.
2. Loop executesfor(a=1;a<=10;a++)
{
if(a%2==0)
3. Sum is displayed.
s=s+p;
}
System.out.println("sum is"+s);
}
}
product
}
3. Sum is displayed.
// multiplication is done
// sum is found each time of the
2. Loop executesfor(a=0;a<=7;a++)
{
s=s+Math.pow(10,a);
// mathematical function is
convert p to int
System.out.print(p+",");
}
3. Sum is displayed.
int s;s=0;int i;
System.out.println("Enter value of n");
int n=Integer.parseInt(in.readLine());
for(i=1;i<=n;i++)
{
s=s+(1+(i*i));
}
System.out.println("Sum is "+s);
}
}
{
s=s+(1+(i*i));
of i and adds 1 to
{
s=(double)(s+(float)(i*(i+1))/(i+(i+1)));
}
System.out.println(s);
}
}
// runs till n
{
s=(double)(s+(float)(i*(i+1))/(i+(i+1)));
to following step
and by type casting
converts it to double type
}
3. Stop.