Answer the question
In order to leave comments, you need to log in
How to insert variable value after % in printf()?
Tell me if it's not difficult. Just started learning C.
int n = 3;
int s[10];
scanf("%s", &s); // допустим "aaa"
printf("%s", s);
printf("%3d", n); // выведет ааа
// 3
// но мне надо, чтобы вместо 3 в printf было значение переменной n
// типо printf("%dd", n, n) Это выведет просто 3n а надо " 3"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question