Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
lab 11 v0.7
//gcc 5.4.0 #include <stdio.h> #include <string.h> typedef struct{ int n; int d; }fraction; int add(fraction a,fraction b){ int A,B,C,s; A=a.n*b.d; B=a.n*b.d; C=a.d*b.d; s=A+B; printf("{%d+%d)/%d=%d/%d",a,b,B,s,B); } int subtract(fraction a,fraction b){ int A,B,C,s; A=a.n*b.d; B=a.n*b.d; C=a.d*b.d; s=A-B; printf("{%d+%d)/%d = %d/%d",A,B,C,s,B); } int multiply(fraction a,fraction b){ int A,B; A=a.n*b.n; B=a.d*b.d; printf("{%d/%d)*(%d/%d) = %d/%d",a.n,a.d,b.n,b.d,A,B); return(0); } int divide(fraction a,fraction b){ int A,B; A=a.n*b.d; B=a.d*b.n; printf("{%d/%d)*(%d/%d) = %d/%d",a.n,a.d,b.n,b.d,A,B); } int main(void) { int o=0; while(o<1){ int c=0; fraction a; fraction b; //int v[4]; scanf("%d",&c); switch(c){ case 1: scanf("%d",&a.n); scanf("%d",&a.d); scanf("%d",&b.n); scanf("%d",&b.d); add(a,b); continue; case 2: scanf("%d",&a.n); scanf("%d",&a.d); scanf("%d",&b.n); scanf("%d",&b.d); subtract(a,b); continue; case 3: scanf("%d",&a.n); scanf("%d",&a.d); scanf("%d",&b.n); scanf("%d",&b.d); multiply(a,b); continue; case 4: scanf("%d",&a.n); scanf("%d",&a.d); scanf("%d",&b.n); scanf("%d",&b.d); divide(a,b); continue; case 5: o++; return(0); } } }
run
|
edit
|
history
|
help
0
hello
get the repeated max
guia 4 terminada
MATRICES DE CADENAS CON PUNTEROS
TopLeftTriangle.c
C programming example for a Person struct and typedef (from ECE 2534)
Michael Bean's Spring 2017 Lab 3 v1
X=1
2
apel