Heres what need to happen.
Enter two consecutive number , add them and show their average.
So The code is Quite correct
I can say
It worked before but if you try and try again .
and try to break it and it will
It'll show -NAN -NAN and -NAN
#include<stdio.h>
#include<conio.h>
float N1,N2,C,D,E;
main()
{
{
clrscr();
printf("Enter A Number:");
scanf("%f",&N1);
printf("Enter A Number Again:");
scanf("%f",&N2);
printf("%.2f and %.2f\n",N1,N2);
C=N2-N1;
D=N1+N2;
E=D*.50;
if(C!=1)
printf("Invalid");
{
if(C==1)
//printf("%f\n",D);
printf("%.2f",E);
}
}
getch();
return 0;
}
Tho it worked before . I want to know why it keeps happening when you try to break it . with same input or different.
what is -NAN how to prevent that from happening
Enter two consecutive number , add them and show their average.
So The code is Quite correct
I can say
It worked before but if you try and try again .
and try to break it and it will
It'll show -NAN -NAN and -NAN
#include<stdio.h>
#include<conio.h>
float N1,N2,C,D,E;
main()
{
{
clrscr();
printf("Enter A Number:");
scanf("%f",&N1);
printf("Enter A Number Again:");
scanf("%f",&N2);
printf("%.2f and %.2f\n",N1,N2);
C=N2-N1;
D=N1+N2;
E=D*.50;
if(C!=1)
printf("Invalid");
{
if(C==1)
//printf("%f\n",D);
printf("%.2f",E);
}
}
getch();
return 0;
}
Tho it worked before . I want to know why it keeps happening when you try to break it . with same input or different.
what is -NAN how to prevent that from happening