+ 1

The value of 'n' is coming 0 even after the input is all numbers. please help!!😢

https://code.sololearn.com/c9b5Pc9vN0N8/?ref=app

30th Jul 2021, 5:51 AM
Gargi
Gargi - avatar
2 Respostas
+ 3
There is a newline character between the first number and the string. If you don't match it, it will remain in the input buffer and block the reading of the string. Change the first call to scanf() to scanf( "%d\n", &N ); to fix this. Also, strtol() is declared in <stdlib.h>, not including the header will probably result in a warning.
30th Jul 2021, 11:17 AM
Shadow
Shadow - avatar
+ 1
You need to know if a number is divisible by each of a group of other numbers. If you are given the number and the group of other numbers, you will test to make sure that it is divisible by all of them. Task: Test your number against all of the other numbers that you are given to make sure that it is divisible by them. Input Format: Two inputs: an integer value (the number you are testing) and a string of variable length of the integers that you should test against separated by spaces. Output Format: A string that says 'divisible by all' or 'not divisible by all'. Sample Input: 100 2 5 10 Sample Output: divisible by all
30th Jul 2021, 5:52 AM
Gargi
Gargi - avatar