What would you like to do?

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?

already exists.

Would you like to merge this question into it?

already exists as an alternate of this question.

Would you like to make it the primary and merge this question into it?

exists and is an alternate of .

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

#include<stdio.h>
#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

for(Index=0;Index<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;
}
4 people found this useful
Thanks for the feedback!
Follow

What will distinguish Undone with @AmandadeCadenet from shows hosted by men?

View Full Interview
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)

How to Make Nail and String Art

A simple way to add color and texture to your decor, with just a few supplies that you may already have on hand, you can create fun nail-and-string art. You can customize the (MORE)

What Is the First String on a Guitar?

If you're trying to teach yourself to play guitar, don't let the instrument-specific terminology confuse you. A chief example of this is the way the strings of the guitar are (MORE)

What would you like to do?

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)