c - better way of printing data with same format -


is there way in c can specify format output once , use printf statement. example in below code want print 10 decimal numbers , know format %d 10 numbers. numbers not stored in array otherwise have put printf in loop. wanted know if there neater way of doing it.

printf("%d%d%d%d%d%d%d%d%d%d\n"1,2,3,4,5,6,7,8,9,10); 

if there definite pattern in example, can still use loop.

for (int = 1; <= 10; i++)     printf("%d", i); printf("\n"); 

if there isn't, should using array anyways.

finally, if issue have lot of literal numbers, can consider reading them data file instead of embedding them source file.


Comments

Popular posts from this blog

python - Mongodb How to add addtional information when aggregating? -

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

ruby - Net::HTTP extremely slow responses for HTTPS requests -