Smart Grids and Energy Storage Systems: Powering the Future of Energy In today’s rapidly evolving energy landscape, the push towards sustainability, efficiency, and reliability is stronger than ever. Traditional power grids, though robust in their time, are no longer sufficient to meet the demands of a modern, digital, and environmentally conscious society. This is where smart grids and energy storage systems (ESS) come into play — revolutionizing how electricity is generated, distributed, and consumed. What is a Smart Grid? A smart grid is an advanced electrical network that uses digital communication, automation, and real-time monitoring to optimize the production, delivery, and consumption of electricity. Unlike conventional grids, which operate in a one-way flow (from generation to end-user), smart grids enable a two-way flow of information and energy. Key Features of Smart Grids: Real-time monitoring of power usage and quality. Automated fault detection and rapid restoration. Int...
C program to check if a number is binary or not
int isBinary(int num) {
while (num != 0) {
if (num % 10 > 1) {
return 0;
}
num /= 10;
}
return 1;
}
int main() {
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (isBinary(num)) {
printf("%d is a binary number.\n", num);
} else {
printf("%d is not a binary number.\n", num);
}
return 0;
}
Explanation :
This program defines a function isBinary that takes an integer num as input and returns 1 if num is a binary number, and 0 otherwise. The function checks each digit of the number by dividing it by 10 and checking if the remainder is greater than 1. If any digit is greater than 1, the function returns 0, indicating that num is not a binary number. If all digits are less than or equal to 1, the function returns 1, indicating that num is a binary number.
In the main function, the program prompts the user to enter a number and then calls the isBinary function to check if the number is binary. Depending on the result, the program prints a message to the console indicating whether the number is binary or not.
Sample output:
Here's an example output of the program for the input of the number 10101010:
Enter a number: 10101010
10101010 is a binary number.
And here's an example output of the program for the input of the number 1234:
Enter a number: 1234
1234 is not a binary number.