program for do-while loop in java.
import java.util.*;
public class marks {
public static void main(String[] args) {
int n;
int mark;
do{
Scanner sc=new Scanner(System.in);
System.out.println("enter a number 1 or 0=");
n=sc.nextInt();
System.out.println("enter the marks of student out of 100=");
mark=sc.nextInt();
if(mark>=90){
System.out.println("this is good.");
}else if(mark>=89 && mark<=60){
System.out.println("this is also good.");
}else{
System.out.println("this is good as well as.");
}
}while(n!=0);
}
}
■》 Output->
enter a number 1 or 0= 1
enter the marks of student out of 100=90
this is good.
Comments
Post a Comment