New course! Every coder should learn Generative AI!
Try a free lesson+ 3
I need help with this!
The following variable has already been declared and assigned: countryPopulation = 3000009; using that variable(do not type the large number) along with text, finish the output statement to output the following: Chinaās population was 3000009 in 2011. My code: printf(āChinaās population was %dā , countryPopulation); My output is : Chinaās population was 3000009. But how I can add āin 2011ā in my code?
13 Answers
+ 6
Exactly like the rest of the text
"China's population was %d in 2011"
+ 4
You just need to write it this way:
printf("China's population was%d in 2011", countryPopulation);
+ 3
Thanks
+ 2
("%d is a lot", countryPopulation)
same format ("%d", varName)
+ 2
The code needs to be in one line. Along with the first one
+ 2
Then do it this way since you want everything on one line:
printf("China's population was %d in 2011. %d is a lot.", countryPopulation, countryPopulation);
+ 2
Same format, and you use \n for line breaks
+ 2
It works!
+ 2
Great!
+ 2
Hello
You can use this way:
int year = 2011;
printf("China's population was %d in %d", countryPopulation, year);
Good luck.
+ 1
So how can I output: 300009 is the popultion. 3000009 is a lot.
+ 1
Iām canāt get the second one
+ 1
Printf(ā%d is the populationā, countryPopulation);