How to get the ASCII value of a character in c



Code to find the ASCII values of given character in c programming language:

#include<stdio.h>

int main(){
  
    char c;

    printf("Enter any character: ");
    scanf("%c",&c);

    printf("ASCII value of given character: %d",c);
        
    return 0;
}

Sample output:
Enter any character: a
ASCII value of given character: 97





10. Write a c program to add two numbers without using addition operator.
11. Write a c program to subtract two numbers without using subtraction operator.
15. Write a c program to solve quadratic equation.
18. Write a c program which passes structure to function.
28. Write a c program which takes password from user.
29. Write a scanf function in c which accept sentence from user.
30. Write a scanf function in c which accept paragraph from user.

No comments: