Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
User Journal

Journal jawahar's Journal: sto code

#include <stdio.h>
#include <stdlib.h>

static char* t = "abcdefghijklmnopqrstuvwxyz";
static char* tt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

int main(int a, char** v)
{
  int i,j;
  int r = 0;

if (a < 2)
{
perror("argv");
exit(0);
}

for (i=0; i<strlen(v[1]); i++)
{
    for (j=0; j<strlen(t); j++)
    {
        if (v[1][i] == t[j] || v[1][i] == tt[j]) r = r+j+1;
        else continue;
    }
}

printf("%d\n",r);
return 0;
}

For God's sake, stop researching for a while and begin to think!

Working...