Advertisement
robeeeert

Contador 1-100 con condiciones

Apr 12th, 2023
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.40 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class p2 {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         int i = 1;
  8.        
  9.         while ( i <= 100) {
  10.             if(i % 3 == 0 && i % 5 == 0) {
  11.                 System.out.println("Programacion 1");
  12.             }else if(i % 3 == 0) {
  13.                 System.out.println("progra");
  14.             }else if(i % 5 == 0) {
  15.                 System.out.println("Macion");
  16.             }else {
  17.                 System.out.println(i);
  18.             }
  19.             i ++;  
  20.         }
  21.  
  22.     }
  23.  
  24. }
  25.  
Tags: Java contador
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement