Just right shift the number by 1.
main()
{
int x=6;
printf("%d\n", y>>1); /* Divide by 2 */
printf("%d\n", y>>2); /* Divide by 4 */
}
Output:
3
1
main()
{
int x=6;
printf("%d\n", y>>1); /* Divide by 2 */
printf("%d\n", y>>2); /* Divide by 4 */
}
Output:
3
1
No comments :
Post a Comment