Name of programmer: Jisan
Programming language: Java
Difficulty: Easy
Status: Accepted
Problem number: UVA-10079
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1020
Code:
import java.util.*;
public class Uva_10079 {
public static void main (String chayapoth[]){
Scanner input = new Scanner(System.in);
long pizza;
while(input.hasNext()){
long sum=1;
long i=1;
pizza=input.nextLong();
if(pizza<0){
break;
}
while(pizza>0){
sum=sum+i;
i++;
pizza--;
}
System.out.println(sum);
}
}
}
Programming language: Java
Difficulty: Easy
Status: Accepted
Problem number: UVA-10079
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1020
Code:
import java.util.*;
public class Uva_10079 {
public static void main (String chayapoth[]){
Scanner input = new Scanner(System.in);
long pizza;
while(input.hasNext()){
long sum=1;
long i=1;
pizza=input.nextLong();
if(pizza<0){
break;
}
while(pizza>0){
sum=sum+i;
i++;
pizza--;
}
System.out.println(sum);
}
}
}
No comments:
Post a Comment