I need to write a c program function that takes in a command

I need to write a c program function that takes in a command line argument where if \'v\' is entered it prints out \"validation\". If \'c\' is entered then \"calculation\" is printed out. If anything else is typed in then an error message will prompt and the program will close out.

Solution

#include <stdio.h>
#include<stdlib.h>
int main()
{
char ch;
printf(\"Enter the value\ \");
scanf(\"%c\",&ch);
if(ch==\'v\')
{
printf(\"validation\ \");
}
else if(ch==\'c\')
{
printf(\"calculation\ \");   
}
else
{
exit(0);
}
  

return 0;
}

I need to write a c program function that takes in a command line argument where if \'v\' is entered it prints out \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site