Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package pkg40313;
- import java.util.*;
- /**
- *
- * @author L1PC08
- */
- public class Main {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- int x[],i,n,s=0;
- Scanner ts=new Scanner(System.in);
- System.out.println(" Introdu n ");
- n=ts.nextInt();
- x=new int[n];
- System.out.println("Introdu vectorul");
- for(i=0;i<n;i++){
- System.out.println("x["+i+"]=");
- x[i]=ts.nextInt();}
- for(i=0;i<n;i++)
- if(x[i]<5)
- s=s+x[i];
- System.out.println(" Suma este"+s);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment