by
amisauv on Tue 9th Dec 9am
// To print semicolons using C programming without using semicolons any where in the C code in program. //
#include<stdio.h>
#include<conio.h>
void main()
{
char a;
a=59;
if(printf("%c",a)){}
getch();
}
When you compile this program you get semicolon ‘;’ on the out put screen. Value of ‘a’ is 59 however I defined ‘a’ as a character, and as you know 59 is numerical value. Hear 59 is ASCII value for a semicolon, hence we are printing ‘a’ character against a numerical value. Another one as :
#include<stdio.h>
#include<conio.h>
void main()
{
if(printf(“%c”,59))
{}
getch();
}
This is very small program. This logic is also implemented in c++.
#include<iostream.h>
#include<conio.h>
Void main()
{
Char a=59;
clrscr();
cout<<a;
getch();
}