Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- int main() {
- char myWord[250];
- printf("If A = 1, B = 2, C = 3, etc. then words have a numerical value.\n");
- while (myWord != '100') {
- printf("Enter word you want to calculate the value of. (Max 250 chars)\n");
- scanf("%s", myWord);
- for(int i = 0; i <= strlen(myWord); i++){
- myWord[i] = toupper(myWord[i]);
- }
- int wordCounter = 0;
- for(int i = 0; i <= strlen(myWord); i++){
- int charCounter = 0;
- for(char j = 'A'; j <= myWord[i]; j++){
- charCounter++;
- }
- wordCounter += charCounter;
- }
- printf("%d\n\n", wordCounter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement