Answer:
To check if the year comes under each 100th year, lets check if the remainder when dividing with 100 is 0 or not.
Similarly check for 400th year and multiple 0f 4. The following C program describes the function.
#include<stdio.h>
#include<stdbool.h>
bool is_leap_year(int year);
void main()
{
int y;
bool b;
printf("Enter the year in yyyy format: e.g. 1999 \n");
scanf("%d", &y); // taking the input year in yyyy format.
b= is_leap_year(y); //calling the function and returning the output to b
if(b==true)
{
printf("Thae given year is a leap year \n");
}
else
{
printf("The given year is not a leap year \n");
}
}
bool is_leap_year(int year)
{
if(year%100==0) //every 100th year
{
if(year%400==0) //every 400th year
{
return true;
}
else
{
return false;
}
}
if(year%4==0) //is a multiple of 4
{
return true;
}
else
{
return false;
}
}
Explanation:
Output is given as image
Answer:
No. This is not more secure.
Explanation:
this is not more secure than having all of Carol, bob and Alice having the same key.
alice would be able to know Carol's key for her to be able to verify the answer Carol gave to a challenge by her. she would also have to know bob's key to do the same.
any of these 3 would have to know someone else's secret key to verify answers to any challenge.
the challenge is to know the secret keys if the other two and if done, decryption can easily be done and they can impersonate.
Answer:
for ( initialization; condition;increment)
{
code goes here;
}
in python:
for i in list/range:
code with proper indentation
By initialization above we mean, like int i=0; etc.
By condition like i<10;
and by increment it means like i++, ++i or i+=1; etc
And in python, i can be an integer value if the range is mentioned, and it can be an item of a list if the list is used. We can also use an array, string and various other data structures in python. like we can have characters in a string and so on.
Explanation:
Please check the answer section.
Answer: This is a partial list of basic safety precautions to use when working on a computer: Remove your watch and jewelry and secure loose clothing. Turn off the power and unplug equipment before performing service. Cover sharp edges inside the computer case with tape. Never open a power supply or a CRT monitor.
Make sure the space underneath your desk is free from clutter and your legs have room to move. Use your mouse as close to the keyboard as possible. Adopt good posture while at the computer. Know how to adjust your chair to the most comfortable position.