You are on page 1of 2

Email Ascii Finder

Code Variations
C,Python,Java

C VERSION
// Online C compiler to run C program online
#include <stdio.h>

int main() {
//code accepts user input
char useremail[30] = "m4botdev@gmail.com";

printf("Your email in ASCII form is : ");


//loop through the input
for (int i = 0; i < strlen(useremail); i++){
//get the ascii code for each character
printf(" %d-",useremail[i]);
}

return 0;
}

OUTPUT:

Your email in ASCII form is : 109- 52- 98- 111- 116- 100- 101- 118- 64- 103- 109- 97- 105-
108- 46- 99- 111- 109-
PYTHON version
#code accepts user input
useremail = "m4botdev@gmail.com"

#loop through the input


#get the ascii code for each character
print("Your email in ASCII form is : ")
for letter in useremail:
print(ord(letter))

JAVA version
class EmailAsciiFinder {
public static void main(String[] args) {

//code accepts user input


String useremail = "m4botdev@gmail.com";

char[] ch = useremail.toCharArray();

//loop through the input


for (char c : ch) {

//get the ascii code for each character


System.out.print((int)c+"-");
}
}
}

-Mustapha

You might also like