Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<iostream>
- #include<string.h>
- using namespace std;
- int main()
- {
- int i,j;
- char str[100];
- char str1[100];
- while(gets(str) && strcmp(str,"#")!=0)
- {
- int l=strlen(str);
- int m=1;
- int j=0;
- int sum=0;
- for(i=0;i<l;i++)
- {
- sum =sum +(((str[i]-'A')+1)*m);
- //str1[j]=str[i]*i;
- m++;
- //j++;
- }
- printf("%d\n",sum);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement