im newbie here.. n need some help..
alphabets got 26 character n each character got secret number..
example: a = 01
alphabets got 26 character n each character got secret number..
example: a = 01
#include <stdio.h>
#include <ctype.h>
main() {
char arr[255];
int valArr[255],index;
clrscr();
printf("Enter string: ");
gets(arr);
for(index=0;index<strlen(arr);++index){
if(arr[index]>='a' && arr[index]<='z'){
valArr[index] = arr[index]-'a'+1;
}
else
{
if (isspace(arr[index]))
{
valArr[index] = '\0';
}
}
}
for(index=0;index<strlen(arr);++index){
printf("%02d",valArr[index]);
}
getch();
}
int a[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
#include<stdio.h>
main()
{
int i,j,size;
char srt[100];
clrscr();
printf("enter your string size");
scanf("%d",&size);
printf("enter your name or a string");
for(i=0;i<=size;i++)
{
scanf("%c",&str[i]);
}
for(i=0;i<=size;i++)
{
for(j=0;j<26;j++)
{
if(str[i]==a[j])
{
printf("\t%d",j+1);
}
}
}
}
\* This program defnetly works.
o/p: enter your string size : 50
enter your name or a string : john abraham
10 15 8 14 1 2 18 1 8 1 13
Comment