|
-
February 18th, 2012, 04:38 PM
#1
function call in c not working???
can someone please tell me why after input y from terminal this code not going to main function??
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main()
{
clrscr();
char answer;
int a,b,y;
printf ("Please enter any number and then FORGET it\n\n\n");
scanf ("%d",&a);
system("cls");
printf ("Now think a different number.....and press any number key when you done...\n\n\n");
scanf ("%d",&y);
clrscr();
printf ("now make it DOUBLE and press any number key when you done...\n\n\n");
scanf ("%d",&y);
b = (a>=0) ? ((a>=10) ? ((a>=20) ? ((a>=30) ? ((a>=40) ? ((a>=50) ? ((a>=60) ? ((a>=70) ? ((a>=80) ? ((a>=90) ? ((a>=100) ? 50 : 98) : 110) : 144) : 168) : 182) : 208) : 226) : 280) : 368) : 420) : 500;
clrscr();
printf ("now ADD %d to it....and press any number key when you done...\n\n\n",b);
scanf ("%d",&y);
system("cls");
printf ("now make it HALF....press number key when you done... \n\n\n");
scanf ("%d",&y);
clrscr();
printf ("from it SUBSTRACT the number you thought in the beginnening\n\n\n");
scanf ("%d",&y);
clrscr();
printf ("\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
printf ("\n The ANSWER IS %d",b/2);
printf ("\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n\n");
printf ("\t\tWanna More??\n\n??Y/N");
answer = getchar();
if (answer == 'y')
main();
getch();
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|