Category: PROGRAMMING

This programming category involves a lot of java programs which can be easily run in bluej. These are much helpful for students. Students of classes 9th to 12th may find it super helping for them in their academics and board exams. Different pattern based and calculation based java programs are available here.

Java PROGRAMMING TOP CONTENT Websites

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 “+sn);}} …

Read more

Lavi Thakur