Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ImparComPar{
- public static void main(String[] args){
- long impar=0,par=0;
- for(long a=1;a<=30;a++){
- if(a % 2==0){
- if(a > 2){
- par = par * a;
- }else{
- par = a;
- }else{
- impar = impar + a;
- }
- System.out.println("Multiplicacao dos pares: "+par);
- System.out.println("soma dos impares: "+ impar);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement