C Programs Unions In C C Program to understand concept of Union Union A union is a user-defined data type available in C that allows all members to store different data types in the same memory location. You can define a union with many members, but only one member can contain a value at any given time. Example Keyword used to define it is union. Like here Saving Bookmark this article Bookmarked

Unions In C C program to find the size of a union Method 1 Without using sizeof operator #include<stdio.h> union student{ int roll; char name; float marks; }; int main(){ union student *ptr = 0; ptr++; printf("Size of the union student: %d",ptr); return 0; } Output Size of the union student: 100 Saving Bookmark this article Bookmarked

C++ Program to Find Factorial For any positive number n, it’s factorial is given by: factorial = 1*2*3...*n Factorial of negative number cannot be found and factorial of 0 is 1. Program #include <iostream> using namespace std; int main() { unsigned int n; unsigned long long factorial = 1; cout << "Enter a posit

C++ Program to Check Leap Year All years which are perfectly divisible by 4 are leap years except for century years (years ending with 00) which is leap year only it is perfectly divisible by 400. Program #include <iostream> using namespace std; int main() { int year; cout << "Enter a year: "; cin >> year; if (y

C Program to Find the Number of Integers Divisible by 5 and their sum In this program, we will ask the user to provide the minimum value and a maximum value range to be added and find integers divisible by 5 and a total of those integers. To find integers divisible by 5, we will first start a for loop with variable i, which is the minimum value N1