Computer Science, asked by appramasamyjmvi, 1 year ago

pls generate the program in java for this​

Attachments:

Answers

Answered by anon64
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