Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
DEAL: For $25 - Add A Second Phone Number To Your Smartphone for life! Use promo code SLASHDOT25. Also, Slashdot's Facebook page has a chat bot now. Message it for stories and more. Check out the new SourceForge HTML5 internet speed test! ×
User Journal

Journal Journal: sto.c

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

Slashdot Top Deals

If God had not given us sticky tape, it would have been necessary to invent it.

Working...