# Thread: Help me pleaseeeeeee ,I have a very hard problem in C language.

1. ## Help me pleaseeeeeee ,I have a very hard problem in C language.

Help me to write this program please.

2. Please refer to the homework policy.

3. Hmmm.

As a clue I would mention modulus again.
Code:
`if (m%k==0)`
that's the remainder.

4. I'm sorry.But it is not homework.It was old examination ( examination of 2007 ) so don't have the answer.Thus, I would like to ask the answer here.

5. Originally Posted by Danlittleboy
I'm sorry.But it is not homework.It was old examination ( examination of 2007 ) so don't have the answer.Thus, I would like to ask the answer here.
Great. I am now assigning it to you as homework. Carry on and do your homework, and then post your attempt here so we can grade it and offer suggestions for improvement.

6. Wow, 16MB in which to do it as well.

7. That's what I thought...

8. Omg !!!!

9. "Hey dude, could you build free house for me?" Pointless to even ask, when you know the answer or maybe there really is a santa claus out there...

10. - For the second point you could try converting (a copy of) the number to a character array & test each digit individually.
- s < 1e19
- use modulus
Good luck, concentrate on doing one point at a time, not worrying about the limitations, then optimise.

11. Wow, that homework is so easy, and you have a whole second to do it in...

So like, do you not understand the problem? Or are you having a problem with your code?

Basically its asking you to return some number OUTPUT (aka S) of which INPUT (aka N) is a factor, and S has to contain only the decimal digits 7 2 and 0.

12. I see two obvious ways to attack this problem. Either test successive multiples of n until you find one with the right digits, or recursively generate all acceptable combinations of the allowed digits until you find one with a zero remainder.
Either way, you'd need a 64-bit data type to do it since the problem description allows up to 20 digits.
Well, that's just off the top of my head anyway.

The best way to solve it is to try. Don't try and pretend, after being reminded of the homework policy, that it isn't homework. So many people do this that we get enough practice to see right through it every time.

13. Code:
```#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <string.h>

void main(void)
{
unsigned long inp,out;
char string[10];

printf("Enter input : ");
scanf("%d",&inp);
printf(" ");
for(out=1;out<=4000000;out++)//unsign long = 4294967
{
nub=0;//Reset nub=0
{

ultoa(out,string,10);//change unsigned long to string
NumString=strlen(string);//Length of string

for(int i=0;i<=NumString;i++)//Loop
{
Mod1=(string[i]=='7');//check char compare 7,2,0
Mod2=(string[i]=='2');
Mod3=(string[i]=='0');
if((Mod1||Mod2||Mod3)==1)//if it has 7,2,0

}
if(nub==NumString)//check Length
{
printf("Output is %s ",string);//output
exit(1);//Exit loop
}
}
}
if(nub==0)//case : not output
{
printf("Nav or Not output ");
}
}```
yes or no

14. its not yes or no question its your homework

15. Does this compile?

If no, what errors do you get? What do you think might be causing this?

If yes, does it work as intended?

If no, in what way? What do you think might be causing this?

If yes, congratulations!