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 <string.h>

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

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;
4 people found this useful
Thanks for the feedback!

To display string in a title case in c?

include<stdio.h> #include<conio.h> #include<string.h> int main() { int tmp,i; char str[30]; printf("Enter any string: "); gets(str); for(i=0; str[i]!=' (MORE)
In Lessons

What are the Strings on the Acoustic Guitar Called in Order?

It is important for you to learn the names of each string on the acoustic guitar, in order, before you start getting more comfortable with learning how to play the guitar. Alt (MORE)
In Repair

Best Online Vendors for Buying Guitar Strings

If you don't have a music store near you, or if you just want to buy in bulk and save a little money, buying your guitar strings online is a great option. Try out some of thes (MORE)

Classical String Quartet Overview

In classical music, the string quartet offers thousands of different pieces to enjoy. Despite how many of these works there are, its not at all unusual for people to be somewh (MORE)
In Lessons

Making a Guitar Truly Yours: Change the Strings Yourself

Changing a guitar string is one of the simplest maintenance operations that you can perform on a guitar. And the advantage of doing it yourself is that you can take the opport (MORE)

Write overload functions in c plus plus to convert an ascii string to an int and to convert an ascii string to float?

Overloads cannot differ by return type alone. The only way to achieve this is to use output arguments. Since the implementation is exactly the same regardless of the output ty (MORE)