/***********************************************************************/
/* PROGRAM TO GENERATE IP ADDRESSES */
/* AUTHOR : DEEPAK MAHAKALE 3 YEAR IT SRCOEM */
/* BLOG : www.mahakaledeepak.blogspot.com */
/***********************************************************************/
#include<stdio.h>
#include<conio.h>
void main() {
int n1, n2, n3, n4, i, j, k, l, m, cnt = 0, a[50];
clrscr();
printf("\n\t* IP ADDRESSES ALLOTTED TO RCOEM * ");
for (i = 5; i < 50; i++) {
n1 = i;
for (j = 1; j < 255; j++) {
n2 = j;
for (k = 5; k < 50; k++) {
n3 = k;
for (l = 1; l < 255; l++) {
n4 = l;
if (n1 + n3 <= 50) {
if (n1 % n4 == 0 && n3 % n4 == 0) {
m = 1;
a[3] = 1000, cnt = 0;
while (m < 10) {
if (n4 % m == 0) {
a[++cnt] = m;
}
m++;
}
if (n2 == a[3] && n2 != n4) {
{
printf("\n\t %d.%d.%d.%d", n1, n2, n3, n4);
}
}
}
}
}
}
}
}
getch();
}
Amazon banner
Sunday, 16 September 2012
PROGRAM TO GENERATE IP ADDRESSES
PROGRAM TO DETECT WHETHER ENTERED NUMBER IS DIVISIBLE BY 11
/***********************************************************************/
/* PROGRAM TO DETECT WHETHER ENTERED NUMBER IS DIVISIBLE BY 11 */
/* AUTHOR : DEEPAK MAHAKALE 3 YEAR IT SRCOEM */
/* BLOG : www.mahakaledeepak.blogspot.com */
/***********************************************************************/
#include<stdio.h>
#include<conio.h>
void main()
{
long int r=0,i=1,odd=0,even=0,no,n,rev=0;
clrscr();
printf("\n\t PROGRAM TO DETECT WHETHER ENTERED NUMBER IS DIVISIBLE BY 11 ");
printf("\n\n\t Enter any number : ");
scanf("%ld",&n);
no=n;
while(no!=0)
{
r=no%10;
rev=rev*10+r;
no=no/10;
}
while(rev!=0)
{
r=rev%10;
if(i%2==0)
{
even=even+r;
}
else
{
odd=odd+r;
}
rev=rev/10;
i++;
}
printf("\n\t Odd sum = %ld \n ",odd);
printf("\n\t Even sum = %ld \n ",even);
if(odd==even)
printf("\n\t %ld Is Divisible by 11",n);
else
printf("\n\t %ld Is Not Divisible by 11",n);
getch();
}
PROGRAM TO VERIFY PRIME NUMBERS PROPERTY
/***********************************************************************/
/* PROGRAM TO VERIFY PRIME NUMBERS PROPERTY */
/* AUTHOR : DEEPAK MAHAKALE 3 YEAR IT SRCOEM */
/* BLOG : www.mahakaledeepak.blogspot.com */
/***********************************************************************/
#include<stdio.h>
#include<conio.h>
void main() {
int n, prime, i, j, k, l;
clrscr();
printf("\n\t PROGRAM TO VERIFY PRIME NUMBERS PROPERTY");
printf("\n\n\t Enter any number : ");
scanf("%d", & n);
printf("\n\t PRIME NO. REMAINDER 1 WHEN DIVIDED BY 4 ");
for (i = 2; i < n; i++) {
prime = 1;
for (j = 2; j < i; j++) {
if (i % j == 0)
prime = 0;
}
if (prime == 1) {
// printf("\n\t %d",i);
if (i % 4 == 1) {
for (k = 1; k < n; k++) {
for (l = 1; l < n; l++) {
if ((k * k) + (l * l) == i) {
printf("\n\t %d --> %d + %d = %d\ti.e %d SQ + %d SQ ", i, k * k, l * l, i, k, l);
}
}
}
}
}
}
printf("\n\n\n\t BY - DEEPAK MAHAKALE");
getch();
}
PROGRAM TO VERIFY VALIDITY OF DATE
/***********************************************************************/
/* PROGRAM TO VERIFY VALIDITY OF DATE */
/* AUTHOR : DEEPAK MAHAKALE 3 YEAR IT SRCOEM */
/* BLOG : www.mahakaledeepak.blogspot.com */
/***********************************************************************/
#include<stdio.h>
#include<conio.h>
void main() {
int d, m, y, y_i = 0, d_i = 0, leap = 0, i, d_l = 0;
clrscr();
printf("\n\t PROGRAM TO VERIFY VALIDITY OF DATE ");
printf("\n\n\t Enter the date (dd mm yyyy) : ");
scanf(" %d %d %d", & d, & m, & y);
if (y < 1600 || y > 2100) // Change this range acc. to you...
{
printf("\n\t Year invalid..");
y_i = 1;
} else {
printf("\n\t Year valid..");
}
if (y_i != 1) {
if (y % 4 == 0)
leap = 1;
}
if (m < 1 || m > 12) {
printf("\n\t Month invalid..");
} else {
printf("\n\t Month valid..");
}
if (d < 1 || d > 31) {
d_i = 1;
}
if (m >= 1 && m <= 7) {
for (i = 1; i <= 6; i++) {
if (m % 2 == 0)
d_l = 30;
if (m % 2 == 1)
d_l = 31;
}
}
if (leap == 0 && m == 2) {
d_l = 28;
}
if (leap == 1 && m == 2) {
d_l = 29;
}
if (m >= 8 && m <= 12) {
for (i = 7; i <= 12; i++) {
if (m % 2 == 0)
d_l = 31;
if (m % 2 == 1)
d_l = 30;
}
}
if (d > d_l)
d_i = 1;
if (d_i == 1)
printf("\n\t Date invalid..");
if (d_i == 0)
printf("\n\t Date valid..");
printf("\n\n\n\t BY - DEEPAK MAHAKALE");
getch();
}
PROGRAM TO PRINT A CALENDAR
/********************************************************/
/* PROGRAM TO PRINT A CALENDAR */
/* AUTHOR : DEEPAK MAHAKALE 3 YEAR IT SRCOEM */
/* BLOG : www.mahakaledeepak.blogspot.com */
/********************************************************/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void main() {
int i, j, f_d, t_d, dt = 1;
clrscr();
printf("\n\t PROGRAM TO PRINT A CALENDAR ");
printf("\n\n\t Enter total no of days : ");
scanf("%d", & t_d);
printf("\n\t Enter first day <0-Mon..5-Sat,6-Sun> : ");
scanf("%d", & f_d);
printf("\n\n\t M \t T \t W \t T \t F \t S \t S \n");
printf("\t _________________________________________________\n");
for (j = f_d; j > 0; j--) {
printf("\t");
}
while (dt <= t_d) {
if (f_d != 0) {
if (f_d % 7 == 0)
printf("\n");
}
printf("\t %d", dt);
dt++;
f_d++;
}
printf("\n\n\n\t BY - DEEPAK MAHAKALE");
getch();
}
Subscribe to:
Posts (Atom)