1public static void main(String[] args) {
2/* 3. write a program which prints out the numbers from 1 to 30:
31. for numbers which are divisible by 3, print "FIN" instead of the number.
42. for numbers which are divisible by 5, print "RA" instead of the number
53. for numbers which are a divisible by both 3 and 5, print "FINRA"
6Ex: 1 2 FIN 4 RA FIN .... FINRA */
7String result = "";
8
9 for (int i = 1; i <= 30; i++) {
10 if (i % 3 == 0 && i % 5 == 0){ //prints number divisible by both 3 & 5
11 // System.out.print(i+"FINRA "); 1.yol
12 result += "FINRA "; // concatenation 2.yol
13 }else if (i %3 == 0){ // prints number divisible by 3
14 // System.out.print(i+ "FIN ");
15 result += "FIN "; // concatenation
16 }else if ( i %5 == 0){
17 ]// System.out.print(i+"RA ");
18 result += "RA "; // concatenation
19 }else{
20 // System.out.print(i+" ");
21 result += i+" "; // concatenation
22 }
23 } //1 2 FIN 4 RA FIN 7 8 FIN RA 11 FIN 13 14 FINRA
24 System.out.println(result);