I want to share my knowledge
I am a professional motivational speaker.
#19 How to Write Program Real Life based Using else if in java ? ELSE IF in Java
लिंक पाएं
Facebook
X
Pinterest
ईमेल
दूसरे ऐप
-
package com.sudhirtheindian2.java123; import java.util.Scanner; public class Else_if_statement { public static void main(String[] args) {
// How to write a program using else if in java // It is used when we have only one if block, // multiple else if block and at the last else block // syntax // if(condition1) // { //// statement 1 // } // else if(condition2){ //// statement 2 // } // else if(condition3){ ////// statement 2 //// } // else{ //// statement 3 // // } int marks; System.out.println("enter your marks"); // 70 - 100 group A // 70 - 60 group B // 60 - 50 group C // 40 - 50 group D // 40> group E Scanner scanner = new Scanner(System.in); marks= scanner.nextInt(); if(marks>=70 && marks<=100){ System.out.println("group A"); } else if(marks<70 && marks>60){ System.out.println("group B"); } else if(marks>=50 && marks<=60){ System.out.println("group C"); } else if(marks>=40&& marks<50){ System.out.println("group D"); } else { System.out.println("group E"); }
Download Hindi Sanskrit Grammar App Hindi Sanskrit Grammar App 1 भारत में #1 हिंदी और संस्कृत व्याकरण सीखने का ऐप ✨ मुख्य Features ✔ 50,000+ Downloads और 4.7★ Rating ✔ Offline Content – बिना इंटरनेट पढ़ाई ✔ Sanskrit + Hindi Grammar topics (Sandhi, Samas, Kaal, Vakya) ✔ Practice Quizzes और Exercises ✔ 90% Free Content + Premium Advanced Lessons 📸 App Screenshots 📸 App Review ...
HackerRank Java Currency Formatter (Hacker Rank Problem Solution) problem: Given a double-precision number, , denoting an amount of money, use the NumberFormat class' getCurrencyInstance method to convert into the US, Indian, Chinese, and French currency formats. Then print the formatted values as follows: US: formattedPayment India: formattedPayment China: formattedPayment France: formattedPayment where is formatted according to the appropriate Locale 's currency. Note: India does not have a built-in Locale, so you must construct one where the language is en (i.e., English). Input Format A single double-precision number denoting . Constraints Output Format On the first line, print US: u where is formatted for US currency. On the second line, print India: i where is formatted for Indi...
HackerRank Java String Reverse Problem Solution A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. Given a string , print Yes if it is a palindrome, print No otherwise. Constraints will consist at most lower case english letters. Sample Input madam Sample Output Yes Solution 1: import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String s = scanner.next(); ...
टिप्पणियाँ
एक टिप्पणी भेजें