answersLogoWhite

0


Best Answer

//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;

}

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: 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?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program in java to display a string message using Servlets?

i dont no string for servlate


C program to copy two strings in to a new string with out using stringcopy in borland c?

You can use so called concatenation of strings:{...string str1 = "something here";string str2 = " and something here";string newStr = str1 + str2;...}


How many strings does a double base have?

the double bass has 4 strings G string D string A string and E string.


Which family dose a violin come from?

The violin is the smallest member of the string family.


What program can be written to count the number of alphanumerics in a string?

public int getStringLength(String val) { return val.length(); } There is an inbuilt functionality in strings that counts the number of alphabets in a string called length()


What groups does the harp play in?

Strings


What family is the string bass in?

it is cause the string bass has 4 strings so it belongs to the string family lol :D


Why is the ukulele a string instrument?

String instruments are called that because they have ... strings.


What does a string instrument need to belong to the string family?

Strings.


What are the names of the strings?

Strings for a Guitar- E or 6th string (low pitched, thickest string) A or 5th string D or 4th string G or 3rd string B or 2nd string E or 1st string (high pitched, thinnest string)


What is the fewest number of strings needed to string a tennis racket?

Two strings are needed to string a tennis racket. The length of the string is to be about 11 to 12 meters.


Law of vibrating strings?

The law of vibrating strings is the vibrational mode of a string that is stretched. The wavelength is twice the length of the string.