#include<iostream.h>
void main()
{
int a,b,r;
cout<<"a=";cin>>a;
cout<<"b=";cin>>b;
while (r!=0)
{
r=a%b;
a=b;
b=r;}
cout<<"cmmdc="<<a;
pty commented: Try reading your error messages -2

woaw, how could i not think about that? thanks sherlock!

You're welcome, glad I could be of service.

commented: Fresh eyes, old professor. +12