0

What printf does?

here's code: #include <stdio.h> int main() { long long i, n = 600851475143; for (i = 3; n > 1; i += 2) while (n % i == 0) n /= i; printf("%lld\n", i - 2); return 0; } What is in printf and what it means?

23rd Sep 2020, 7:11 PM
ItzNekS
ItzNekS - avatar
4 Respostas
0
%lld is used to print long long integer.
23rd Sep 2020, 7:28 PM
Avinesh
Avinesh - avatar
0
when i change it to std::cout << n; it outputs 1, and why in printf is i - 2 ?
23rd Sep 2020, 7:49 PM
ItzNekS
ItzNekS - avatar
0
Run the while loop like this, it will make more sense. while (n % i == 0) { n /= i; printf("%lld is divided by %lld\n", n,i); }
23rd Sep 2020, 8:07 PM
Avinesh
Avinesh - avatar
0
printf function prints the text on console..it is used in c language
25th Sep 2020, 10:14 AM
Twinkle Baisane
Twinkle Baisane - avatar