Define a function PrintFeetInchShort with int parameters num

Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using \' and \" shorthand. Ex: PrintFeetInchShort(5, 8) prints:

Hint: Use \\\" to print a double quote.

#include <stdio.h>

/* Your solution goes here */

int main(void) {
   PrintFeetInchShort(5, 8);
   printf(\"\ \");

   return 0;
}

Please help me figure out this code in C programming.

Solution

#include <stdio.h>
int PrintFeetInchShort(int a,int b); //Defining the Function
/* Your solution goes here */
int main(void) {
PrintFeetInchShort(4,5);
printf(\"\ \");
return 0;
}

int PrintFeetInchShort(int a, int b) //declaring the function
{
printf(\"%d\\\'%d\\\"\",a,b); //We are escaping both the single quotes and double quotes with \\\' and \\\"
}

Thanks for the question, have a good day, would be glad to help you if any doubt arises.

Define a function PrintFeetInchShort, with int parameters numFeet and numInches, that prints using \' and \

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site