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 .

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?
//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!
C program to accept any numbers and alphabets and display its ascii value?

C program to accept any numbers and alphabets and display its ascii value?

include   #include   void main()   {   char ch;   clrscr();   printf("enter to know ascii value");   scanf("%c",&ch);   printf("%d",ch);  

Write a c program to accept alist of 10 namews input by user then display the sorted list of names back to the user?

, since you seem to be needing help with your homework, I can give you some psuedo code to help you on your way! [CODE] DECLARE ARRAY names[10] FOR i = 0 TO 9 names[i]
Write a program to accept two numbers and display their sum?

Write a program to accept two numbers and display their sum?

include #include #include void main() { clrscr(); int a,b,sum; printf("Enter first number "); scanf("%d",&a); printf("Enter second number "); scanf("%d",&b
Write a program to accept a character value from the user and sHow its ASCII value?

Write a program to accept a character value from the user and sHow its ASCII value?

#include #include main() { clrscr(); int x; char y; printf("enter the number"); scanf("%d",&x); printf("enter the char"); scanf("%c",&y); if(sizeof(x)2)
How do you convert a string of characters into ASCII values in C language?

How do you convert a string of characters into ASCII values in C language?

Basically what i need the code to do is to change a string of characters in to either uppercase or lowercase depending on wether or not the 3 input character is upper or lower
Write a program to accept a string from keyboard and count and display the numbers of vowels present in the string?

Write a program to accept a string from keyboard and count and display the numbers of vowels present in the string?

#include int str_vowels(char* s) { int numbers = 0; int n = 0; while(s[n]!='\\0') { if(s[n]'a'||s[n]'e'||s[n]'i'||s[n]'o'||s[n]=='u') { numbers++; } n++; } return

Write a program to print all ASCII?

for (int i = 0; i<=255; i++)   {   char x = i ;   cout << "Ascii value of " << i << ":: " << x << "\\n";   }

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

Write a program to accept a string from keyboard and count and display the numbers of vowels present in the string by using function?

You need to scan through the string and keep track of the vowels occurring.  Here is a sample program: #include#include int countVowels(char[] s){ int count = 0, i; for( i=0