+ 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?

13th Jan 2022, 1:45 AM
Altesse
13 Answers
+ 6
Exactly like the rest of the text "China's population was %d in 2011"
13th Jan 2022, 1:49 AM
CGM
CGM - avatar
+ 4
You just need to write it this way: printf("China's population was%d in 2011", countryPopulation);
13th Jan 2022, 1:54 AM
Jessy Baki
+ 3
Thanks
13th Jan 2022, 1:58 AM
Altesse
+ 2
("%d is a lot", countryPopulation) same format ("%d", varName)
13th Jan 2022, 2:01 AM
CGM
CGM - avatar
+ 2
The code needs to be in one line. Along with the first one
13th Jan 2022, 2:04 AM
Altesse
+ 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);
13th Jan 2022, 2:08 AM
Jessy Baki
+ 2
Same format, and you use \n for line breaks
13th Jan 2022, 2:10 AM
CGM
CGM - avatar
+ 2
It works!
13th Jan 2022, 2:15 AM
Altesse
+ 2
Great!
13th Jan 2022, 2:16 AM
Jessy Baki
+ 2
Hello You can use this way: int year = 2011; printf("China's population was %d in %d", countryPopulation, year); Good luck.
13th Jan 2022, 8:19 AM
Morteza R.g
Morteza R.g - avatar
+ 1
So how can I output: 300009 is the popultion. 3000009 is a lot.
13th Jan 2022, 1:59 AM
Altesse
+ 1
I’m can’t get the second one
13th Jan 2022, 1:59 AM
Altesse
+ 1
Printf(“%d is the population”, countryPopulation);
13th Jan 2022, 2:00 AM
Altesse