Вы находитесь на странице: 1из 3

1)

#include<stdio.h> int mult(int x, int y); int main() { int x,y; printf("Please input two numbers to be multiplied: "); scanf("%d",&x); scanf("%d",&y); printf("\nThe product of your two numbers is %d\n",mult(x,y)); return 0; } int mlt(int x,int y) { return x*y; }

2)

#include<stdio.h> int main() { int a,b,c; int choice; print_menu(); choice= read_choice(); printf("\n Enter 3 values:"); scanf("%d%d%d",&a,&b,&c); if(choice==1) find_max(a,b,c); else if(choice==2) find_min(a,b,c); return 0; } print_menu() { printf("1. Find The Biggest Number\n"); printf("2. Find The Smallest Number\n"); } int read_choice() { int choice; printf("Enter your choice please :"); scanf("%d",&choice); return choice; } find_max(int a,int b,int c)

{ if(a>b && a>c) printf("\n Biggest is %d\n\n",a); else if(b>a && b>c) printf("\nBiggest is %d",b); else printf("Biggest is %d\n",c); } find_min(int a,int b,int c) { if(a<b && a<c) printf("smallest is %d\n",a); if(b<a && b<c) printf("smallest is %d\n",b); else printf("smallest is %d\n",c);

Вам также может понравиться