Program to convert string into ASCII values in c programming language:
#include<stdio.h>
void main(){
char str[100];
int i=0;
printf("Enter any string: ");
scanf("%s",str);
printf("ASCII values of each characters of given string: ");
while(str[i])
{
printf("%d ",str[i++]);
}
getch();
}
Output:
Enter any string: ctechnotips.blogspot.com
ASCII values of each characters of given string: 99 116 101 99 104 110 111 116 105 112 115 46 98 108 111 103 115 112 111 116 46 99 111 109
#include<stdio.h>
void main(){
char str[100];
int i=0;
printf("Enter any string: ");
scanf("%s",str);
printf("ASCII values of each characters of given string: ");
while(str[i])
{
printf("%d ",str[i++]);
}
getch();
}
Output:
Enter any string: ctechnotips.blogspot.com
ASCII values of each characters of given string: 99 116 101 99 104 110 111 116 105 112 115 46 98 108 111 103 115 112 111 116 46 99 111 109
0 comments:
Post a Comment