Program to print a semicolon without using semicolon in the code
Sabtu, 04 Januari 2014
0
komentar
Hello friends,
Today I'm gonna share a program where you can print a semicolon as a output without using semicolon in the code.When we use printf("") statement we have to use semicolon at the end.If we want to print a semicolon, we use the statement: printf(";" );In above statement, we are using two semicolons . The task of printing a semicolon without using semicolon anywhere in the code can be accomplished by using the ASCII value of';'which is equal to 59.
NOTE:
Today I'm gonna share a program where you can print a semicolon as a output without using semicolon in the code.When we use printf("") statement we have to use semicolon at the end.If we want to print a semicolon, we use the statement: printf(";" );In above statement, we are using two semicolons . The task of printing a semicolon without using semicolon anywhere in the code can be accomplished by using the ASCII value of';'which is equal to 59.
#include
int main(void)
{
//prints the character with ascii value 59, i.e., semicolon
if (printf("% c\n", 59))
{
//prints semicolon
}
return 0;
}
Output:
;
NOTE:
If statement checks whether return value of printf function is greater than zero or not. The return value of function
call printf("%c ",59) is 1. As printf returns the length of the string printed. printf("%c ",59) prints ASCII value that
correspond s to 59, that is semicolon( .
TERIMA KASIH ATAS KUNJUNGAN SAUDARA
Judul: Program to print a semicolon without using semicolon in the code
Ditulis oleh Unknown
Rating Blog 5 dari 5
Semoga artikel ini bermanfaat bagi saudara. Jika ingin mengutip, baik itu sebagian atau keseluruhan dari isi artikel ini harap menyertakan link dofollow ke https://androidjones7.blogspot.com/2014/01/program-to-print-semicolon-without.html. Terima kasih sudah singgah membaca artikel ini.Ditulis oleh Unknown
Rating Blog 5 dari 5
0 komentar:
Posting Komentar