Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- int X, Y, Q, comp, W=1, i, o=1;
- printf("Ingresa los valores en X:");
- scanf("%i",&X);
- printf("Ingresa los valores en Y:");
- scanf("%i",&Y);
- if (X==0 || Y==0){
- printf("Solo hay una combinacion.");
- }
- if(X>0 && Y>0){
- Q=X+Y;
- }
- if(X<0 && Y>0){
- Q=(-X)+(Y);
- }
- if(X>0 && Y<0){
- Q=(X)+(-Y);
- }
- if(X<0 && Y<0){
- Q=(-X)+(-Y);
- }
- for(i=2;i<=Q;i++){
- W=(W)*(i);
- }
- for(i=2;i<=(Q-2);i++){
- o=(o)*(i);
- }
- comp=(W/(2*(o)));
- printf("Hay: %i combinaciones.",comp);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement