# include <stdio.h>
int main(void)
{
// 59 is the ascii value of semicolumn
if (printf("%c ", 59))
{
}
return 0;
}
Output:
;
Sample C program to accept an integer and reverse it.
# include <stdio.h>
void main()
{
long num, reverse = 0, temp, remainder;
printf("Enter the number\n");
scanf("%ld", &num);
temp = num;
while (num > 0)
{
remainder = num % 10;
reverse = reverse * 10 + remainder;
num /= 10;
}
printf("Given number = %ld\n", temp);
printf("Its reverse is = %ld\n", reverse);
}
Output:
Enter the number
567865
Given number = 567865
Its reverse is = 568765
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com