Solution ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Solution ?

#include<stdio.h>   int main() {     char *s = "Geeks Quiz";     int n = 7;     printf("%.*s", n, s);     return 0; }

17th Dec 2018, 5:45 PM
Vashisth Malik
Vashisth Malik - avatar
6 Answers
+ 6
You have Code playground, why don't you write code for the exercise!👍
17th Dec 2018, 5:51 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 6
Hi Vashisth Malik, In Sololearn, you can coding in Sololearn Code Playground. https://code.sololearn.com/#c++
17th Dec 2018, 6:08 PM
program
program - avatar
+ 6
You can use an asterisk (*) to pass the width specifier/precision to printf(), rather than hard coding it into the format string! https://stackoverflow.com/questions/7899119/what-does-s-mean-in-printf
17th Dec 2018, 6:12 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 4
Try to play with ThisOne! ;)👍😉 https://code.sololearn.com/clAAj9H0AM7w/?ref=app
17th Dec 2018, 6:36 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 1
Ok, can you tell what is going on in printf ?
17th Dec 2018, 6:00 PM
Vashisth Malik
Vashisth Malik - avatar
+ 1
Solution?? Void print(int n) { if(n<0) Return; Printf("%d",n); ...........(n-1); } Output:
26th Dec 2019, 9:27 AM
Shubham Nagpure
Shubham Nagpure - avatar