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.
Printf is used to format a output as required;
%d is for int, similarly we have %s for String and %f for float and so on.
Also we have %n for the new line which serves the purpose of println for printf.
Here the first %d is matched with the first value after the ',', if the format dosent match exception is thrown.
%d --> N
%d --> i
%d --> N*i
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Java Loops I
You are viewing a single comment's thread. Return to all comments →
Printf is used to format a output as required; %d is for int, similarly we have %s for String and %f for float and so on. Also we have %n for the new line which serves the purpose of println for printf. Here the first %d is matched with the first value after the ',', if the format dosent match exception is thrown. %d --> N %d --> i %d --> N*i