|
||
Title: Divide by 3 - itoa() Post by kens on Jul 23rd, 2007, 8:33pm 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. |
||
Title: Re: Divide by 3 - itoa() Post by Sameer on Jul 23rd, 2007, 8:52pm 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 |
||
Title: Re: Divide by 3 - itoa() Post by vinay_sahu on Aug 18th, 2012, 8:07pm 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(); } |
||
Powered by YaBB 1 Gold - SP 1.4! Forum software copyright © 2000-2004 Yet another Bulletin Board |