English
Open in Telegram

Thread Message #1838

3 messages · –
  1. K
    import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int t = sc.nextInt(); for (int i = 0; i < t; i++) { int n = sc.nextInt(); int sum = 0; String square = BigInteger.TWO.pow(n).toString(); for (int j = 0; j < square.length(); j++) { sum += square.charAt(j) - 48; } while (sum >= 10) { n = sum; sum = 0; for (; n > 0; n /= 10) { sum += n % 10; } } System.out.println(sum); } } }
CCore Java | Java for BeginnersCore Java | Java for Beginners@codeitupjava · group · Tech
1 312members62writing in 30 days
Venue feed Open in Telegram

An open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · Index limits · Remove a page · Catalog · Search · How we count