Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program to find a given no. is divisible by 3 or not
without using any arthimetic operators?

Answer Posted / siva prabhu

#include<stdio.h>

int main()
{
int x,y,i=0,j=0,r=0;
printf("enter a num\n");
scanf("%d",&x);

if(x>3)
{
while(x>0)
{
i=0;
while(i<3)
{
--x;
++i;
}
++j;
if(x<3)
{
r=x;
printf("reminder is %d\n",x);
break;
}
}
if(r==0)
printf("the given is divisible by 3\n");
else
printf("the given no. is not %% by %3\n");
}
else
{
printf("the given no. is not %% by %3\n");
}
return 0;
}

Is This Answer Correct ?    10 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can include files be nested?

1105


Are there namespaces in c?

1120


How can you convert integers to binary or hexadecimal?

1028


What is wrong with this initialization?

1005


Why is this loop always executing once?

1054


Should a function contain a return statement if it does not return a value?

1077


List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.

2740


What is infinite loop?

1083


What is the use of parallelize in spark?

1029


Is main is user defined function?

1142


What is structure padding in c?

1130


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2447


What is putchar() function?

1152


How many header files are in c?

1036


Can you write the algorithm for Queue?

2108