Showing posts with label coding. Show all posts
Showing posts with label coding. Show all posts

Sunday, 21 June 2015

why is %d used not %i for printing integers ??


Why format specifier for integer is %d not %i in c programming language?


Have you ever wondered that format specifier written in c language like character type has %c ,float type has %f and string type has %s but integer type doesnt have %i instead it has its format specifier %d?
This is because integer is divided into subcategories decimal integer, binary integer,hexadecimal integer and octal integer and %d is used for decimal integer as its format specifier and the results we often want is of decimal type if we want our solution then different fomat specifier can be used to obtain the desired output
  • %d - decimal integer
  • %o - octal integer
  • % x- hexadecimal integer
Note:there doesn't exists any format specifier for binary integer.

stay tuned to our blog for keep getting cool facts like this..
And please comment if you like this post

Sunday, 14 June 2015

print counting in c++ without using loop,recursion and goto


counting without using loop,recursion or goto

can you write a code for printing counting without using loop,recursion,goto statement?

hey everyone who likes to code has written a code in c++ for coding.also everyone has designed a code for printing counting 1 to 100. but can you design a code for printing counting without using loop,recursion and goto statement?
The one answer could be simply printing 1 to 100 using cout statement but that's not a coder's answer.
the one could be using class and the code is written below
interesting isnt it??
there are more alternatives ways, try to design one of your own
bbye... and stay tuned for more such interesting posts......