Im really new to C and coding in general so sorry if this is a simple problem.
All I'm trying to do is input some numbers, get them to be added up, and then print the sum in two different ways. However for some reason the printf("%li", z);
line of code is only printing the amount of digits in the number plus 1
.
Could someone explain to me why exactly it is doing this, please? The why what's important, I'm not actually too bothered about getting it to work since I'm just playing around and practising. Thanks!
My code is as follows:
#include <cs50.h>
#include <stdio.h>
int main(void) {
long x = get_long("what is x: ");
long y = get_long("what is y: ");
long z = printf("%li\n", x + y + y);
printf("%li", z);
}