Convert a string to ASCII in c

Program to convert string into ASCII values in c programming language:


int main(){
    char str[100];
    int i=0;

    printf("Enter any string: ");

    printf("ASCII values of each characters of given string: ");
         printf("%d ",str[i++]);
    return 0;

Sample Output:
Enter any string:
ASCII values of each characters of given string: 99 113 117 101 115 116 105 111 110 98 97 110 107 46 98 108 111 103 115 112 111 116 46 99 111 109

3. Write a c program to delete the all consonants from given string.


Haris said...

Thanx for da GUIDE in all programs GOD BLESS U.

Anonymous said...

c program to calculate 8 bit crc

Vishu said...

u missed the & for scanf

Anonymous said...

when using string, you don't need to use & :D

Anonymous said...

great man keep it up?

Ayesha Jawed said...

Write a program that takes a string as input and generates an encoded string as output. Each letter of the input string is encoded by a given rule. Numerical value (1 for A, 2 for B, 10 for J and so on) of the letters are used to define the rules for encoding. The rules for generating codes are as follows:
A – E

Add 3 in its numerical value.

U -- Z

Find the largest integer factor of its numerical value less than the value itself. Multiply it by 12.
For Z, numerical value is 26, largest integer factor of 26 is 13 so, (13*12) is 156 which wraps around all the alphabets 6 full times and ends on Z.
For B,Y, encoded value will be E, H.

this question is of encryption can anyone solve this?

Unknown said...

I'm a complete beginner but I wanted to share my try at this program.


for(int x; (x = getchar()) != EOF; printf("%d ", x));

I just thought this would be worth sharing since the program in the post seems pretty long for something so simple.

Unknown said...

Weird, it cut out certain parts... Here's a link then:

Unknown said...

please give a method to store the ascii value in another array as i have to use the ascii value further in program

Vijayakash said...

Python Training in Chennaii

I am glad that I have visited this blog. Really helpful, eagerly waiting for more updates