Facebook
From Hridoy , 1 Month ago, written in C++.
Embed
Download Paste or View Raw
Hits: 118
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. void gcm_lcm()
  6. {
  7.     int a, b, gcd, lcm, mul;
  8.  
  9.     cin >> a >> b; // 15 6
  10.  
  11.     mul = a*b;
  12.     while (b%a != 0)
  13.     {
  14.         int tmp = b; // 6
  15.         b = a; // 15
  16.         a = tmp%a; // 6 % 15 = 6
  17.     }
  18.  
  19.     gcd = a;
  20.  
  21.     printf("GCD: %d\n", gcd);
  22.  
  23.     lcm = mul / gcd;
  24.  
  25.     printf("LCM: %d\n", lcm);
  26.  
  27.  
  28.     /** vag shess 0 hole vajok gcd
  29.     jodi 0 na hoy tahole vag shess vajok and vajok hbe vajjo
  30.     */
  31.  
  32.  
  33.     /** lcm: emon ekta songka jeti ek e sathe a diye o nisshes e vibajjo
  34.     and b diye o nisshes e vibajj and songkati sorbo nimnno songka ortat er cheye
  35.     chuto r kunu songka nei jeti ek sathe a and b uboy diyei nisshese bivajjo
  36.  
  37.     6 15
  38.     GCD: 3
  39.     LCM: 30
  40.     */
  41. }
  42.  
  43. void greatest_of_four()
  44. {
  45.     int a,b,c,d;
  46.     printf("Enter the Four Numbers :");
  47.     scanf("%d %d %d %d",&a,&b,&c,&d);
  48.  
  49.     if(a>b)
  50.     {
  51.         if(a>c)
  52.         {
  53.             if(a>d)
  54.             {
  55.                 printf("%d is big",a);
  56.             }
  57.             else
  58.             {
  59.                 printf("%d is big",d);
  60.             }
  61.         }
  62.     }
  63.     else if(b>c)
  64.     {
  65.         if(b>d)
  66.         {
  67.             printf("%d is big",b);
  68.         }
  69.         else
  70.         {
  71.             printf("%d is big",d);
  72.         }
  73.     }
  74.     else if(c>d)
  75.     {
  76.         printf("%d is big",c);
  77.     }
  78.     else
  79.     {
  80.         printf("%d is big",d);
  81.     }
  82. }
  83.  
  84. void goto_statement()
  85. {
  86.     int i=10;
  87.  
  88. A:
  89.     if(i<=100)
  90.     {
  91.         printf("%d ", i);
  92.         i+=10;
  93.         goto A;
  94.     }
  95. }
  96.  
  97. int main()
  98. {
  99.  
  100.     /**int sum = 0;
  101.     for(int i=1; i<=5; i++) {
  102.         sum = sum+i*i; /// 0 1 2 3 4
  103.     }
  104.     printf("%d\n", sum); */
  105.  
  106.     int i=2;
  107.  
  108.     do
  109.     {
  110.         printf("Hello\n");
  111.  
  112.         i++;
  113.     }
  114.     while(i<=5);
  115.  
  116.     return 0;
  117. }
  118.