/* Assign 1 to 26 for alpphabets then multiply each char of each string and do sum for s1 and s2 . if the result is equal print CHOOSEN other wise NOT CHOOSEN
s1="AB" , s2="AB"
o/p CHOOSEN
x=1*2 ->2
y=1*2->2
if x==y print CHOOSEN other wise "NOT CHOOSEN"
*/
# include <stdio.h>
void solution(char*S,char*T) {
int x=1,y=1
for(i=0;S[i]!=0;i++)
{
x*=S[i]-64;
}
for(i=0;T[i]!=0;i++)
{
y*=T[i]-64;
}
if((x%47)==(y%47))
printf("CHOOSEN");
else
printf("NOT CHOOSEN");
}
main(){
char s1[50],s2[50];
solution("ABC","ABC");
}
s1="AB" , s2="AB"
o/p CHOOSEN
x=1*2 ->2
y=1*2->2
if x==y print CHOOSEN other wise "NOT CHOOSEN"
*/
# include <stdio.h>
void solution(char*S,char*T) {
int x=1,y=1
for(i=0;S[i]!=0;i++)
{
x*=S[i]-64;
}
for(i=0;T[i]!=0;i++)
{
y*=T[i]-64;
}
if((x%47)==(y%47))
printf("CHOOSEN");
else
printf("NOT CHOOSEN");
}
main(){
char s1[50],s2[50];
solution("ABC","ABC");
}
No comments:
Post a Comment