একটি সাল Leap Year কি না দেখার Algorithm, Flowchart and C Program.
Algorithm
1. Start
2. Input হিসাবে X এর মান নেই।
3. X%100 == 0 করি। যদি Yes হয় 4 নং এ যাই আর No হলে 5 নং এ যাই।
4. X%400 == 0 করি। যদি Yes হয় Output হিসাবে Leap Year দেখাই আর No হলে Output হিসাবে Not Leap Year দেখাই। এবং 6নং যাই।
5. X%4 == 0 করি। যদি Yes হয় Output হিসাবে Leap Year দেখাই আর No হলে Output হিসাবে Not Leap Year দেখাই। এবং 6নং যাই।
6. Stop
Flowchart
C Program
#include <stdio.h>
#include <conio.h>
void main()
{
int x;
printf("Please Enter A Year:");
scanf("%d",&x);
if(x%100==0)
{
if(x%400==0)
{
printf("This Year is Leap Year");
}
else
{
printf("This Year is not Leap Year");
}
}
else
{
if(x%4==0)
{
printf("This Year is Leap Year");
}
else
{
printf("This Year is not Leap Year");
}
}
}
Comments
Post a Comment