March 16, 2010

遞回練習公因數(3個數)_


#include<stdio.h>
#include<stdlib.h>
int gcd(int a,int b)
{ int d
    if(a%b==0)
   return b;
    else
    return  gcd(b,a%b);
}
int main(void)
{
  int a,b,c;
    printf("Given three number:\n");
     scanf("%d",&a);
     scanf("%d",&b);
     scanf("%d",&c);
     printf("We get the result:\n");
     printf("gcd(%d,%d,%d)=%d\n",a,b,c,gcd(gcd(a,b),c));
         
          system("pause");
          return 0;
          }

0推薦此文章
Today's Visitors: 0 Total Visitors: 10
Personal Category: 科學 Topic: technology / tech info / programming
歷史上的今天:

誰來收藏
Loading ...
unlog_NVPO 0