int main() { int i =2,k= 6,z = 0; z = ((~k)+1) + i; printf("result %d\n",z); }
May not be the best way but try something like this
int main () { int a=5, b=1 ,c; c=0; while (a >= b) // this is assuming that you are subtracting b from a and answer is positive { b ++; c++; } printf("ans = %d \n",c); }
I am search for different approach. Let see how many solution i can get
How will we print numbers from 1 to N without using loop or recursion?