PROGRAM TO CHECK WHETHER THE INPUT YEAR GIVEN IS A LEAP YEAR OR NOT;
STATEMENT:
A year Y will be passed as input. The program must find if the given year is a leap year or not.
- If it is leap year, the program must print yes else it should print no
PROGRAM:
#include<stdio.h>
#include <stdlib.h>
int main()
{
int year;
scanf("%d",&year);
if(year%400 == 0){
printf("yes");
}
else
if(year%100 == 0){
printf("no");
}
else
if(year%4 == 0){
printf("yes");
}
else
{
printf("no");
}
}
Input/Output:
If 2000 is the input, the program must print yes
If 2100 is the input, the program must print no
If 2013 is the input, the program must print no
PROGRAM TO CONVERT THE GIVEN RUPEE(INDIAN CURRENCY) TO PAISE:
STATEMENT:
A floating point value F indicating the amount in rupees is passed as input. The program must print the corresponding value in paise.
PROGRAM:
#include <stdio.h>
int main()
{
int rupee,paise;
scanf("%d.%d",&rupee,&paise);
int result = rupee*100 + paise;
printf("%d",result);
}
INPUT:
11.30
OUTPUT:
1130
No comments:
Post a Comment