PROGRAM-1


// Program of greatest common divisor
  #include
  #include
  void gcd(int,int);
  void main()
  {
   clrscr();
   int x,y;
   printf("enter the value of x");
   scanf("%d", &x);
   printf("enter the value of y");
   scanf("%d", &y);
   gcd(x,y);
   getch();
  } void gcd(int u,int v)
  {
   printf("the gcd of %d and %d is", u,v);
   while(v!=0)
   {
    int temp=u%v;
    u=v;
    v=temp;
   }
   printf("%d",u);
}
Algorithm
·                     Start
·                     Declare x, y as integer
·                     Write(“value of x”)
·                     Read(“x”)
·                     Write(“value of y”)
·                     Read(“y”)
·                     Gcd(x, y) (call function)
·                     Stop
·                     Declare u, v, temp as integer
·                     Write gcd of u and v
·                     Do – while start
temp=u%v
  u=v
 v=temp
·                     Do end
·                     Read(“u”)

#vpsinghrajput

Author & Editor

Has laoreet percipitur ad. Vide interesset in mei, no his legimus verterem. Et nostrum imperdiet appellantur usu, mnesarchum referrentur id vim.

1 comments: