Friday, August 17, 2018

ENCRYPTION

  • Problem Description

    Cryptography is a technique that helps to implement security. Flora loves cryptography , She sends a string that replaces each characters with its third letter. Help her to write a code to read the string. Add each characters ascii value of the string with the position of the character present in the string. Print the above manipulated value as well as the manipulated character.
  • CODING ARENA
  • #include <stdio.h>
    #include<string.h>
    int main()
    {
      char c[20];
      int x,i;
      scanf("%s",c);
      x=strlen(c);
      for(i=0;i<x;i++)
      {
        c[i]=c[i]+(i+1);
      }
      printf("%s",c);
    return 0;
    }
  • Test Case 1

    Input (stdin)
    hello
    
    
    Expected Output
    igopt
  • Test Case 2

    Input (stdin)
    hai
    
    
    Expected Output
    icl

No comments:

Post a Comment