Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.67 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. int main()
  5. {
  6.     int X, Y, Q, comp, W=1, i, o=1;
  7.     printf("Ingresa los valores en X:");
  8.     scanf("%i",&X);
  9.     printf("Ingresa los valores en Y:");
  10.     scanf("%i",&Y);
  11.     if (X==0 || Y==0){
  12.         printf("Solo hay una combinacion.");
  13.     }
  14.     if(X>0 && Y>0){
  15.     Q=X+Y;
  16.     }
  17.     if(X<0 && Y>0){
  18.         Q=(-X)+(Y);
  19.     }
  20.     if(X>0 && Y<0){
  21.         Q=(X)+(-Y);
  22.     }
  23.     if(X<0 && Y<0){
  24.         Q=(-X)+(-Y);
  25.     }
  26.     for(i=2;i<=Q;i++){
  27.         W=(W)*(i);
  28.     }
  29.     for(i=2;i<=(Q-2);i++){
  30.         o=(o)*(i);
  31.     }
  32.     comp=(W/(2*(o)));
  33.     printf("Hay: %i combinaciones.",comp);
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement