Websites

Mastering Web Development

Mastering Web Development: A Guide to HTML, CSS, and JavaScript Mastering Web Development. In today's digital age, web development has…

1 year ago

Understanding a pattern code in java.

The process of understanding a pattern code to print it in Java can be broken down into several steps: Steps…

2 years ago

Mahatma Gandhi:My experiments with truth(Biography) short note 2023

Mahatma Gandhi Mahatma Gandhi was the greatest national leader of India. He was also a great politician, an organiser and…

2 years ago

How to write a java program to accept n numbers as input from user till user inputs 0, the program will terminate when user inputs 0, after terminating the sum of all positive numbers and sum of all negative numbers will be displayed on screen.

import java.util.*;class Nums_Sum{public static void main(){Scanner in=new Scanner(System.in);double n=0,sp=0,sn=0;do{System.out.println("Enter number ");n=in.nextDouble();if(n>0)sp=sp+n;if(n<0)sn=sn+n;if(n==0)System.out.println("0 input terminating.");}while(n!=0);System.out.println("Sum of positive number "+sp);System.out.println("Sum of negative number…

3 years ago