wu :: forums
« wu :: forums - Divide by 3 - itoa() »

Welcome, Guest. Please Login or Register.
Dec 12th, 2024, 7:59am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   cs
(Moderators: ThudnBlunder, william wu, Grimbal, Icarus, SMQ, towr, Eigenray)
   Divide by 3 - itoa()
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Divide by 3 - itoa()  (Read 5535 times)
kens
Junior Member
**





   


Posts: 59
Divide by 3 - itoa()  
« on: Jul 23rd, 2007, 8:33pm »
Quote Quote Modify Modify

Without using /,% and * operators. write a function to divide a number by 3.
char *itoa(int) function is available.
 
 
Please tell me how to do this problem.
IP Logged
Sameer
Uberpuzzler
*****



Pie = pi * e

   


Gender: male
Posts: 1261
Re: Divide by 3 - itoa()  
« Reply #1 on: Jul 23rd, 2007, 8:52pm »
Quote Quote Modify Modify

You should really check before you post and the solution was just few posts away!!
 
http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi?board=riddles_cs; action=display;num=1185094398
IP Logged

"Obvious" is the most dangerous word in mathematics.
--Bell, Eric Temple

Proof is an idol before which the mathematician tortures himself.
Sir Arthur Eddington, quoted in Bridges to Infinity
vinay_sahu
Newbie
*





   


Posts: 1
Re: Divide by 3 - itoa()   div3.c
« Reply #2 on: Aug 18th, 2012, 8:07pm »
Quote Quote Modify Modify

hey,,it's too easy man.... ;D
# include<stdio.h>
# include<conio.h>
# include<stdlib.h>
# include<string.h>
main()
{
      int i,j=0,len;
      char buffer[30],ch;
      printf("enter the no that you want to chek ");
      scanf("%d",&i);
      itoa(i,buffer,3);
      len=strlen(buffer);
      if(buffer[len-1]=='0')
                            printf("number is divisible by 3");
      else  
                            printf("number is not divisible by 3 ");
      getch();
}
 
« Last Edit: Aug 18th, 2012, 8:12pm by vinay_sahu » IP Logged
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board