Category archives for: C/C++ Programming

C Program to Check if the Number is a prime

3042898913_97d05cddef_o

This Program asks the user to enter any number and it checks wither this number is prime or not. Code [v1] #include "stdio.h" #include "conio.h" void main() { int num,prime = 1,i; printf("Enter a number: "); scanf("%d", &num); for(i=2; i<num; i++) { if(num%i == 0) { prime = 0; break; } } if(prime) printf("The Number [...]

  • Share/Bookmark

C Program to Reverse a Given Number

palindrome

Here is a program that mathematically reverse any given numer. The program uses simple functions, an easy and fast flow. Code #include "stdio.h" #include "conio.h" void main() { int num, rev = 0, dig; printf("Enter a number: \t"); scanf("%d", &num); while(num>0) { dig = num % 10; rev = rev * 10 + dig; num [...]

  • Share/Bookmark
Your Ad Here

Recent Trackbacks

ourSTATS

Sponsors

Photo Gallery

Your Ad Here
Log in | Designed by Gabfire themes