Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C code that performs the following functions: Input three different inte

ID: 3787277 • Letter: W

Question

Write a C code that performs the following functions: Input three different integers from the keyboard Use the largest one to plus the smallest one and print the result on the screen The factorial of a nonnegative integer n is written n! (pronounced "n factorial") and is defined as follows: n! = n times (n - 1) times (n - 2) times ... times 1 (for values of n greater than or equal to 1) and n! = 1 (for n 0). For example, 5! = 5 times 4 times 3 times 2 times 1, which is 120. write a program that reads a nonnegative integer and computes and prints its factorial.

Explanation / Answer

1)

#include<stdio.h>
#include<conio.h>

int main()
{
   int a,b,c;
   int biggest,smallest;
   printf("enter the three numbers ");
scanf("%d%d%d",&a,&b,&c);
if( ( a> b) && (a > c) )
{
biggest=a;


}
else if(b > c)
{

biggest=b;
}
else
{

biggest=c;
}

if( (a < b) && (a < c) )
{

smallest=a;
}
else if(b < c)
{

smallest=b;
}
else
{

smallest=c;
}

int larplusSmall=biggest+smallest;
printf("the sum value is %d",larplusSmall);
getch();
return 0;


   }

output

enter the three numbers
40
60
20
the sum value is 80

2)

#include <stdio.h>
int main()
{
int no, i;
unsigned long long fact= 1;

printf("Enter an integer: ");
scanf("%d",&no);

  
if (no < 0)
printf("Error! to find the factorial of a given is not possible");

else
{
for(i=1; i<=no; ++i)
{
fact *= i;
}
printf("Factorial of %d = %llu", no, fact);
}

return 0;
}

output

enter a number :6

the factorial is 720

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote