We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importjava.util.*;importjava.io.*;classSolution{publicstaticvoidmain(String[]argh){Scannerin=newScanner(System.in);intt=in.nextInt();for(inti=0;i<t;i++){inta=in.nextInt();intb=in.nextInt();intn=in.nextInt();inttwo_component=1;intterm=a;for(intj=0;j<n;j++){//term is ((2^(i) *b))term+=(two_component*b);System.out.print(term+" ");two_component=two_component<<1;}System.out.println();}in.close();}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Loops II
You are viewing a single comment's thread. Return to all comments →