answersLogoWhite

0


Best Answer

You don't need to write a program to do this. Each character (char) is actually an int. If you want to see the ASCII value of a char you can simply:

char c = 'a';

System.out.print( (int)c );

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

import java.io.BufferedReader;

class GetAsciiValue

{

public static void main(String arg[])

{

InputStreamReader isr=new InputStreamReader(System.in);

BufferedReader br= new BufferedReader(isr);

System.out.println("Enter a character or string");

String s=br.readLine();

for(int i=0;i<s.length();i++)

System.out.println("ASCII value of:"+s.charAt(i)+"is"+(int)s.charAt(i));

}

}

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

#include

#include

main()

{

clrscr();

int x;

char y;

printf("enter the number");

scanf("%d",&x);

printf("enter the char");

scanf("%c",&y);

if(sizeof(x)==2))

{

printf("the equivalent char for given integer is %c ",x);

}

elseif(sizeof(y)==1)

printf("the equivalent integer for given char is %d ",y); getch();

}

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

#include<stdio.h>

#include<conio.h>

void main()

{

char ch;

clrscr();

printf("Enter the character\n");

scanf("%c",&ch);

printf("The ASCII value of entered character is : %d",ch);

getch();

}

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

class ASCII

{

public void main(){

char a;

for (int i = 65; i <=90; i++)

{

a = (char)i;

System.out.println(i + ": " + a); // TODO add your handling code here:" +

}

}

}

This answer is:
User Avatar

User Avatar

Wiki User

9y ago

ASCII value of 'a' is 97. Here is the complete list of ASCII value of characters in C Programming. When a character is stored in variable of type.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to accept a character value from the user and sHow is its ASCII value?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a C program to accept a string from user and display its ascii value and then display sum of all ascii value of strings?

//C program to accept a string from user and //display its ascii value and //then display sum of all ascii value of strings #include&lt;stdio.h&gt; #include &lt;string.h&gt; int main() { char String[100]; int Sum,Index; Sum=0; //Sum is initially zero printf("Enter the string:\n"); gets(String); //Accept String from User for(Index=0;Index&lt;strlen(String);Index++) { Sum+=(String[Index]); //Adds (the ASCII values of) the String characters. } printf("The sum is %d\n",Sum); //Printing it as %d gives the equivalent ASCII value. return 0; }


Why would you use ASCII instead of Binary?

ASCII = American Standard Code for Information InterchangeThat means that ASCII is a type of character encoding...Unless you want to write in 1's and 0's, then you must use ASCII. If you type a single character, it's most likely ASCII. To show you how ridiculous typing in binary is:011101110110100101101011011010010010000001100001011011100111001101110111011001010111001001110011 = wiki answers (lowercase)


American standard for information interchange ASCII?

ASCII is code in which computer programs are written . it is the computer machine language.if write a program in any computer language thaen it will be converted in this code.


How do you write BASIC program to accept variables?

dim a input a


Write a Java program to get the ASCII value of the given number?

If you look up the ASCII values for digits, you'll see that 0 = 48, 1 = 49... 9 = 57. So it's a simple matter of adding 48 to your digit to find out the ASCII value for it.


Write a c program to accept a numbers and generate square root cube and exponential values?

write a c program to accept a number and generate a square root cube and exponential values


How do I write a program that converts sentences into Morse code?

This is done with an algorithm that takes a text string and process each letter in turn. In computing text letters are usually coded as ASCII characters where the character is encoded as a specific numeric value. The algorithm will obtain this value and use it as in index into an array storing the Morse Code representation for every ASCII character. The output of the algorithm with thus be a Morse translation of the text input.


How do you use codes?

To write secret letters if you are a spy. To write computer programs. To deal with character sets (ASCII etc) To know how to behave and dress (social and dress code)


How to write a program to accept the user name and password and then shop this is your Password?

you cant


Write a program to enter a character and it will tell the character etered?

{char a;...cout > a;cout


Write a program to print all the ascii values and the corresponding representation?

int main (void) { int i; for (i=32; i&lt;=127; ++i) printf ("%3d: '%c'\n", i, i); }


Write a c program to accept name and store the name in its short form?

happy birthday...