Can somebody correct this C language program?
Would you please look at and find one and you should explain what the situation is:
BTW inside the out fit it provides
Enter in the girl or boy MF (here that misses the actual brackets in addition to slash)
and you will find other problems so remember to need help.
this is the rule:
#include
#include
emptiness main()
clrscr();
int years;
char gen, q;
printf(“Enter the actual Gender (M\F):\t”);
scanf(“%c”, &gen);
printf(“Enter the actual Qualification (P\G):\t”);
scanf(“%c”, &q);
printf(“Enter time of Provider:\t”);
scanf(“%d”, &yrs);
in the event that (yrs>=10)
in the event that (gen == ‘M’)
in the event that (q == ‘P’)
printf(“The Salary is 15000 rs”);
other than them if (q == ‘G’)
printf(“The Salary is 10000 rs”);
else
printf(“invalid input”);
other than them if (gen == ‘F’)
in the event that (q == ‘P’)
printf(“The Salary is 17000 rs”);
other than them if (q == ‘G’)
printf(“The Salary is 12000 rs”);
else
printf(“invalid insight for qualification”);
else
printf(“invalid insight in gender”);
other than them /*(yrs<10)*/
in the event that (gen == ‘M’)
in the event that (q == ‘P’)
printf(“The Salary is 10000 rs”);
other than them if (q == ‘G’)
printf(“The Salary is 7000 rs”);
else
printf(“invalid input”);
other than them if (gen == ‘F’)
in the event that (q == ‘P’)
printf(“The Salary is 12000 rs”);
other than them if (q == ‘G’)
printf(“The Salary is 10000 rs”);
else
printf(“invalid insight for qualification”);
else
printf(“invalid insight in gender”);
getch();
To present a ” \ ” inside a string, you should just put two times slashes ” \\ “.
Another trouble i recognized was that the second input got skipped.To address this, i put an fflush(stdin) leading to a scanf.The explanation for this is a result of buffer.The fflush deletes everything inside the buffer, so that the upcoming scanf wont take in any undesirable data outstanding from just before.For the primary input, you key in “M”.Then you certainly press your enter critical.There can be two characters inside the buffer, the “M” as well as “enter key”.The first scanf saves the figure “M”, then your second scanf saves whatever is usually left while in the buffer, that’s the “enter key”, thus causing to be and then located for the third input.
#include
#include
emptiness main()
//clrscr();
int years;
char gen, q;
printf(“Enter the actual Gender (M\\F):\t”);
fflush(stdin);
scanf(“%c”, &gen);
printf(“Enter the actual Qualification (P\\G):\t”);
fflush(stdin);
scanf(“%c”, &q);
printf(“Enter time of Provider:\t”);
fflush(stdin);
scanf(“%d”, &yrs);
in the event that (yrs>=10)
in the event that (gen == ‘M’)
in the event that (q == ‘P’)
printf(“The Salary is 15000 rs”);
other than them if (q == ‘G’)
printf(“The Salary is 10000 rs”);
else
printf(“invalid input”);
other than them if (gen == ‘F’)
in the event that (q == ‘P’)
printf(“The Salary is 17000 rs”);
other than them if (q == ‘G’)
printf(“The Salary is 12000 rs”)
Leave a Reply
You must be logged in to post a comment.