Advertisement
Md_hosen_zisad

1s compliment

Oct 18th, 2017
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.  
  5.  
  6. int l, j,i;
  7. char str[20];
  8. gets(str);
  9. l=strlen(str);
  10. for(j=l-1;j>=0;j--)
  11. {
  12. if(str[j]=='1')
  13. str[j]='0';
  14. else
  15. str[j]='1';}
  16.  
  17. printf("%s",str);
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement