Hey hi I have a problem with to C++ programs for my final project, the problem is that i tried to make the code but first the C++ program say general protection exception i read some of this but i still think that the structure of my program is not good so i will post to u the original problem and give me opinions please(I just know basic stuffs of C++):
Make a program to calculate maximum common divisor of two positive whole number using the Euclides algorithm.
The two whole positive numbers are identified with the letters M and N
Euclides Algorithm
1.-Divide N by M, R =Residue
2.- If R=0, M is the maximum common divisor and the program end.
3.-Assign to N the values of M and assign the the values of R to M and start again the step 1
code i use:
#include<stdio.h>
#include<conio.h>
#include<math.h>
main(void)
{
int N, M, R, D, Y, F, Z, S;
printf("\nPlease enter N\n");
scanf ("%s", N);
printf("\nPLease enter M\n");
scanf ("%s", M);
D=N/M;
Y=M*D;
R=N-Y;
if(R=0)goto A;
printf("%d\n",R);
if(R>0)goto B;
B:
F=M/R;
Z=M*F;
S=M-Z;
A:
return(0);
}
The other problem i don't understand the part of no using logarithms the original problem is:
2.- Make a program to calculate AB , B can be positive or negative whole number or zero. Can´t use logarithms.
Thank you in advance for u help and sorry if its difficult to understand my problems but translated from spanish and sorry if i made some mistakes.