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!

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

import java.io.BufferedReader; class GetAsciiValue { public static void main(String arg[]) { InputStreamReader isr=new InputStreamReader(System.in); BufferedReader br= new Bu

Write a program to accept two string and display weather they are identical or not?

I assume the program should be case-sensitive. Here is a code of such program:   #include #include int main() { char str1[100]; char str2[100]; printf("Please

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

How can you scan a letter from a String and store it as an integer so that you can compare ASCII values?

A String is essentially a character array with advanced functionality. Any character from a String object can be accessed by calling String's charAt(int position) method. This