C program to Convert Octal to Decimal

Write a C program to convert octal to decimal using a while loop. In this c example, the while loop iterate and divides the value into digits, and the decimal = decimal + (octal % 10) * pow(8, i++) statement convert octal to decimal number.  #include <stdio.h> #include <math.h> int main() { int octal, decimal … Read more

C program to Convert Octal to Binary

Write a C program to convert octal to binary using a while loop. In this c example, the first while loop converts octal to decimal, and the second while loop converts a decimal to binary.  #include <stdio.h> #include <math.h> int main() { int i, octal, decimal = 0; long binary = 0; i = 0; … Read more

C program to Check a Number is a Neon Number

Write a c program to check a number is a neon number or not using the for loop. If the number equals the sum of digits of the square of a number, it is a neon number. We use the math pow function to find the square of a number. Divide the output into individual … Read more

C Program to Find the Largest of Three Numbers using a Pointer

Write a C program to find the largest of three numbers using a pointer. First, we assign the user entered three integers to pointers. Next, this c example uses the nested if else statements to check and find the largest pointer number among the three. #include <stdio.h> int main() { int a, b, c, *pa, … Read more

C Program to Find the Largest of Two Numbers using a Pointer

Write a C program to find the largest of two numbers using a pointer. It allows the user to enter two integer values, and then we assign them to two pointer variables of int type. In this example, we used the else if statement to find the largest of two pointer numbers. #include <stdio.h> int … Read more

C program to Check the Number is a Krishnamurthy Number

Write a C program to check the number is a Krishnamurthy number using for loop. First, if the numbers equal the sum of factors of individual digits of it, it is a Krishnamurthy number. This C example divides the number into individual digits and finds the sum of factors of each digit. Next, if condition … Read more

C program to Find the Distance Between Two Points

Write a C program to find the distance between two points. As per the Pythagoras theorem, the distance between two points, i.e., (x1, y1) and (x2, y2), is √(x2 – x1)2 + (y2 – y1)2. This example accepts two coordinates and prints the distance between them. We used the C library Math functions sqrt and … Read more

C Program to Find the Range of Data Types

Write a C program to find the range of data types using the c library and without it. In this programming language, all the range information, such as the minimum and maximum constants, will be within the limits and float header files. The limits.h header file has information about integers and characters. At the same … Read more

C Program to Create Initialize and Access a Pointer Variable

Write a c program to create, initialize, and access a pointer variable with an example. In this example, we declared an integer value, assigned it to the pointer of int type, and printed that pointer value and address. #include <stdio.h> int main() { int num; int *pnum; pnum = &num; num = 200; printf(“Information of … Read more

C program to Count Vowels and Consonants in a String using a Pointer

Write a C program to count vowels and consonants in a string using a pointer and a while loop: We assigned a string to the character pointer. The if statement checks whether any character equals a, e, i, o, u. If true, vowel count will increment. Otherwise, consonants count incremented. Finally, this example prints the … Read more