0

Write a program to find the ASCII code of the symbol '~' which is called as tide.

Printf("%c", ~) is this correct? Or anything else!!! Please do help 🌝me):

2nd Nov 2021, 7:00 AM
Giggling_ddl.
5 Answers
+ 4
printf("%d",'~');
2nd Nov 2021, 7:24 AM
Simba
Simba - avatar
+ 2
Yeah its correct if you are not sure it is correct or not then u can use for loop and inside loop use if condition like this here i work as a counter variable. #include <stdio.h> int main() { for (int i=0;i<255;i++) { if(i=='~') { printf("ASCII of (~) symbol is %d ",i) ; } } char c='~'; printf("\n%d" ,c); return 0; }
2nd Nov 2021, 7:27 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Swagatika Pradhan no thisone is not valid here your char (c) should be in small letters then in printf u used %d and u writting ~ hypen which is not a valid variable name here you need to write the name of variable which u want to print See this #include <stdio.h> int main() { char a= '~'; printf ("%d", a); return 0; } Note : always do dry run before compiling the code and try to fix errors self
3rd Nov 2021, 4:36 AM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
Thanks a lot👍): Yaa I'll!
3rd Nov 2021, 4:41 AM
Giggling_ddl.
0
Or- #include <stdio.h> int main() { Char a; a= '~'; printf ("%d", ~); return 0; }
3rd Nov 2021, 4:32 AM
Giggling_ddl.