answersLogoWhite

0

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

15y ago

What else can I help you with?

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


What are the recommended string gauges for a 12-string guitar?

The recommended string gauges for a 12-string guitar are typically lighter gauge strings for the higher octave strings and heavier gauge strings for the lower octave strings. This helps to balance the tension and ensure proper tuning and playability.


Why is the ukulele a string instrument?

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


What is a program to accept a 3 digit integer and display its octal conversion value?

public class PrintOctal { public static void main(String[] args) { int n = Integer.parseInt(args[0]); System.out.printf("%o\n", n); } }


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)