I'm trying to run a program with 3 levels:1st Menu, 2nd Input and Output and 3rd Calculations.
But it keeps me giving me permition denied and Id returned 1 exit status when I try to compile. any suggestion?
here is the code
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int calcpercent (int xx,int yy);
int calclargest (int pp, int rr, int qq);
void percent ();
void large ();
int menu ();
int main ()
{
int choice;
choice = menu ();
while (choice!=3)
{
switch (choice)
{
case 1:
{
percent ();
break;
}
case 2:
{
large ();
break;
}
default:
{
printf ("wrong entry!\n");
}
}
choice = menu ();
}
}
int menu ()
{
int choice;
printf("chhoose from the following:\n");
printf ("(1)calculate percentage.\n");
printf ("(2)calculate largest.\n");
printf ("(3)quit.\n");
scanf ("%d",&choice);
return choice;
}
/*input and output*/
void percent ()
{
int x,y;
printf("enter 2 numbers:\n");
scanf ("%d%d",&x,&y);
int result;
result=calcpercent(x,y);
printf ("the percentage=%d",&result);
}
void large ()
{
int p,r,q;
printf ("3 numbers please:\n");\
scanf ("%d%d%d",&p,&r,&q);
int insult;
insult=calclargest (p,r,q);
printf ("the largest=%d",&insult);
}
/*calculations*/
int calcpercent ()
{
int xx;int yy;int zz;
zz=(xx/yy)*100;
return zz;
}
int calclargest ()
{
int pp,rr,qq,w;
if (pp<rr && pp<qq)
w=pp;
else
if (rr<pp && rr<qq)
w=rr;
else
w=qq;
return w;
}