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

16y ago

What else can I help you with?

Continue Learning about Engineering

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

i dont no string for servlate


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()


C plus plus program that display student name course and grade using arrays of strings?

enum field { name, course, grade }; std::string student[3]; student[name] = "Joe Bloggs"; student[course] = "C++ Programming"; student[grade] = "A+";


Create a program in java that will accept 2 strings and display in concatenated form?

class demo { public static void main(String[] args) { if(args.length == 2) { System.out.println(args[0] + args[1]); } else { System.out.println("Usage: demo Str1 Str2"); } }


What is a string in programming?

A string is a process within a computer program. However, the word "process" is normally used for the main program, so you might think of it as a sub-process. In any case, the idea is that with threads, you can split up your code to run different processes simultaneously. If the computer has several available processors, the strings may really be running simultaneously; if there are more strings than processors, the operating system (or perhaps in some cases the runtime environment?) will simulate this, by alternating the available processors among the strings, so that each one runs for a short time, say, a few milliseconds.

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.


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); } }


Why is the ukulele a string instrument?

String instruments are called that because they have ... 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 does a string instrument need to belong to the string family?

Strings.