Question: QN . 1 . Write a program in C to calculate the factorial of a given number using loops. QN . 2 . Write a
QN Write a program in C to calculate the factorial of a given number using loops.
QN Write a program in C to check whether a given number is prime or not.
QN Modify the following code to use recursion instead of a loop:
#include
int main
int i;
for i ; i ; i
printfd
i;
return ;
QN
What would be the output of:
#include
void display;
int main
printfWelcome
;
display;
return ;
void display
static int count ;
printfto C programming
;
count;
ifcount
main;
QN USING CONDITIONAL STATEMENTS, WRITE THE C PROGRAMMING CODE FOR THE FOLLOWING:
a A parking lot charges $ for the first hour or part thereof and $ for each additional hour or part thereof. Ask the user for the number of hours parked and calculate the total charge.
b A library charges a fine for books returned late. For the first days, the fine is $ per day, for to days the fine is $ per day, and above days the fine is $ per day. Ask the user for the number of days the book is late and calculate the fine.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
