Problem Name: Y = MX
Everyone know that the equation of a straight line is Y = MX + C. But if C = 0, then the straight line is passing through the origin. Here I always put C = 0. So our equation will be always Y = MX. Straight line is a geometrical term but my problem is not geometrical. I just use the equation Y = MX. Since Y = MX, so Y is must be divisible by M and X, and for a specific value of Y and various value of M and X, the equation must be satisfy.
But in this problem we find (N) the number of M and X that satisfy the equation with condition M must be less than X (M16 = 1 * 16 (1<16) so it is countable.
16 = 2 * 8 (2<8) so it is countable.
16 = 4 * 4 (4 = 4) so it is not countable.
16 = 8 * 2 (8>2) so it is not countable.
16 = 16 * 1 (16>1) so it is not countable.
So our answer N=2.
So your duty is to find out how many way to find M and X (M
Input: You have to provide an integer Y (1<=Y<=10000).
Output: You just print the value of N.
Sample input:
16
Sample output:
2
what output i'll get for following those input 128,500,666,1000,10000?
i need code and solution
i tried many time but can't get logic. how i improve my logic?
help to clera this program logic concept. ... Shift+R improves the quality of this image. Shift+A improves the quality of all images on this page.
Code:#include<stdio.h> int main() { int a,b,c=1,i; scanf("%d",&a); for(i=2;i<=a;i+=2) { if((a%i)==0) { printf("%d ",i); b=(a%i); } if(b>i) c++; } printf("\n%d",c); }