ChatterBank2 mins ago
please please someone help me!!!
please can someone please tell me the coding of how to make a program in C language
Q1:to find the factorial of a given number.
(factorial means that e.g. if the given number is 5 then the factorial will be 5x4x3x2x1=120)
Q2: create a program that will return the ASCII value of the character you type.
all has to be done is C. thank you so much in advance.
Q1:to find the factorial of a given number.
(factorial means that e.g. if the given number is 5 then the factorial will be 5x4x3x2x1=120)
Q2: create a program that will return the ASCII value of the character you type.
all has to be done is C. thank you so much in advance.
Answers
Best Answer
No best answer has yet been selected by arianas. Once a best answer has been selected, it will be shown here.
For more on marking an answer as the "Best Answer", please visit our FAQ.Shouldn't really be doing your home/course work for you but as it's simple enough to find.
Here is a little program that prints the ascii code of any key
#include <stdio.h>
#include <conio.h>
#define ESC 27
int main(int argc, char* argv[])
{
int key;
while(1)
{
key = getch();
if(key == ESC)
break;
if(key == 0 || key == 224)
key = -getch();
printf("%d\n",key);
}
return 0;
}
Here is a little program that prints the ascii code of any key
#include <stdio.h>
#include <conio.h>
#define ESC 27
int main(int argc, char* argv[])
{
int key;
while(1)
{
key = getch();
if(key == ESC)
break;
if(key == 0 || key == 224)
key = -getch();
printf("%d\n",key);
}
return 0;
}