Number Programs

C Program to convert IP address to 32-bit longint

Source: Dr. G T Raju, Professor & Head, Dept. of CSE, RNSIT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 #include <math.h> #include <stdio.h> #include <string.h> #include […]


C Program to convert IP address to 32-bit long int

Source: Dr. G T Raju, Professor & Head, Dept. of CSE, RNSIT 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 #include <stdio.h> #include <string.h> #include <stdlib.h> union iptolint { char ip[16]; […]


program to accept ten numbers from the user and display the lowest one

This program accepts ten numbers from the user and display the lowest one, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #include "conio.h" #include "stdio.h"   void main() { int num[10],low,i=0,j=1; printf("\nPlease provide 10 numbers to find lowest one […]


C program to calculate the GCD of a number

Write a program to calculate the Greatest Common Divisor(GCD) of a number #include<stdio.h> #include<conio.h> #include<process.h> int gcd(int m,int n) { int rem; while(n!=0) { rem=m%n; m=n; n=rem; } return(m); } main() { int num1,num2,num3,gcd1,gcd2; clrscr(); printf("Enter three positive integers"); scanf("%d%d%d",&num1,&num2,&num3); if(num1==0 && num2==0 && num3==0) { printf("\n Invalid number"); exit(0); } gcd1=gcd(num1,num2); gcd2=gcd(num3,gcd1); printf("\n GCD […]


To find the sum of the cos series

Here is the program to find the Cosine of the given angle for the user defined accuracy. This is a fast, reliable and robust program, which uses no sophisticated functions but a simple while loop and other math functions. Logic: The program follows the mathematical cosine series, where cosine of the entered radian angle ? […]


Program to find the sum of the sine series

Here is the program to find the Sinusoidal value of the given angle for the user defined accuracy. This is a fast, reliable and robust program, which uses no built in functions but a simple while loop and other math functions. Logic: The program follows the mathematical sine series, where cosine of the entered radian […]