Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class czterdziescijeden {
  4.        
  5.    
  6.     public static void main(String[] args) {
  7.         Scanner sc = new Scanner(System.in);
  8.         System.out.println("Podaj liczbe wyrazów ciągu arytmetycznego o różnicy równej 3: ");
  9.         int n = sc.nextInt();
  10.         int ciag=1;
  11.        
  12.        for (int i=0; i<=n;i++){
  13.         ciag+=3;
  14.        }
  15.        System.out.println("ciag arytmetyczny : "+ciag+"");
  16.    
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement