Advertisement
ImranIF

Encryption function

Jan 25th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. //Using encryption function, f(p)=p+3; find secret number produced from a given integer N
  2. #include<stdio.h>
  3. #include<stdlib.h>
  4. int main(){
  5. int p[30], num, N, b, count=0, i;
  6. scanf("%d", &N);
  7. b=N;
  8. while(b!=0){
  9.     count++;
  10.     b/=10;
  11. }
  12. for(i=0;i<count;i++){
  13.     p[i]=N%10;
  14.     N/=10;
  15. }
  16. printf("Output:");
  17. for(i=count-1;i>=0;i--){
  18.     p[i]=p[i]+3;
  19.     printf("%d", p[i]);
  20. }
  21.  
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement