Join Telegram Channel for DXC exam Discussion & help!

Encryption DXC Automata Fix Questions and Answers AMCAT

Question:

Encryption DXC Automata Fix Questions AMCAT

char* encryption(char* str)
{
 // write your CODE here
}

Solution:

#include<stdio.h>
#include<string.h>
char* encryption(char* str) {
 int i,j=0,k,ws=0,val;
 char word[20];
 int len=strlen(str);
 for(i=0;i<=len;i++){
 if(str[i]==' ' || str[i]=='\0')
 {
 val=0;
 for(k=j-1;k>=0;k--)
 {
 word[k]=word[k]+val;
 val++;
 if(word[k]>122)
 word[k]='a'+(word[k]-123);
 str[ws+k]=word[k];
 }
 ws=i+1;
 j=0;
 }
 else
 word[j++]=str[i];
 }
 return str;
}
int main()
{
 char str[]="yum feed",*s;
 s=encryption(str);
 printf("%s",s);
 return 0;
}

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.