pls generate the program in java for this
Attachments:
Answers
Answered by
1
Answer:
Attention: I don't know what is the meaning of the boxes. I am writing 0 instead, whatever it is write inside S=.......
1) i )
public class cal
{
public static void main(int n)
{
int S=1+(1+2)+(1+2+3)+0+(1+2+
3+0+n
System.out.println("The sum
is="+S)
}
}
ii)
public class cal
{
public static void main(int n)
{
float S=1/2-1/4+1/8-1/16+
1/32-0*1/n
System.out.println("The sum
is="+S)
}
}
Similar questions
Math,
6 months ago
English,
6 months ago
Social Sciences,
1 year ago
Science,
1 year ago
Science,
1 year ago