How to print 1, 11,111,1111...n using java Get link Facebook X Pinterest Email Other Apps - March 16, 2021 / common way to write int a=1,n=10 ; // n value you can take anythingfor(int i=1;i<=n;i++){System.out.print(a+" ,");a=a*10+1;} Get link Facebook X Pinterest Email Other Apps Comments Unknown24 March 2021 at 19:35Noice Xd:) soumyaReplyDeleteRepliesReplyAdd commentLoad more... Post a Comment
How to print 9,99,8,89,7,79.... - March 16, 2021 / common way to write int a=9,n=10 ; // n value you can take anything for(int i=1;i<=n;i++) { if(i%2==1) { System.out.print(a); } else { System.out..print(a*10+9); a--; }} Read more
print the series 2+4+6+8+...n using java - April 01, 2021 int a=2,n=10; // n for number of terms //a is the starting value int sum=0; for(int i=1;i<=n;i++) { sum=sum+a; a=a+2; } System.out.println(sum); Read more
Noice Xd
ReplyDelete:) soumya