Write a program that would input an integer number and then indicate whether the
ID: 3868238 • Letter: W
Question
Explanation / Answer
Important Note: Since you haven't mentioned the name of programming language, I have assumed that you need it in C programming language. But if you want the programs in some other language then mention it in the comments I will modify the programs in that language.
#include<stdio.h>
int main()
{
int num;
printf("Enter an integer: ");
scanf("%d", &num);
if(num % 2 == 0)
printf("Input number is even.");
else
printf("Input number is odd.");
}
#include<stdio.h>
int main()
{
char REPLY;
printf("Enter the REPLY value: ");
scanf("%c", &REPLY);
switch (REPLY)
{
case 'Y': printf("YES, LET'S DO IT"); break;
case 'N': printf("NO, I WON'T DO IT"); break;
case 'M': printf("MAYBE I WILL"); break;
case 'S': printf("SURE DUDE"); break;
}
}
#include<stdio.h>
int main()
{
int year;
printf("Enter the year: ");
scanf("%d", &year);
if(year % 4 == 0)
{
if(year % 100 == 0)
{
if(year % 400 == 0)
printf("The year is a leap year");
else
printf("Input year is not a leap year.");
}
else
printf("The year is a leap year");
}
else
{
printf("Input year is not a leap year.");
}
}
#include<stdio.h>
int main()
{
int day;
int month;
printf("Enter the month: ");
scanf("%d", &month);
printf("Enter the day: ");
scanf("%d", &day);
if(month == 4 || month == 6 || month == 9 || month == 11)
{
if(day >= 1 && day <= 30)
printf("Entered month and day is valid.");
else
printf("Invalid day!");
}
else if(month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12)
{
if(day >= 1 && day <= 31)
printf("Entered month and day is valid.");
else
printf("Invalid day!");
}
else if(month == 2)
{
if(day >= 1 && day <= 29)
printf("Entered month and day is valid.");
else
printf("Invalid day!");
}
else
printf("Invalid month and day combination.");
}
#include<stdio.h>
int main()
{
double income;
double exemptedAmt;
double NTI;
double tax = 0;
printf("Enter the gross income: ");
scanf("%lf", &income);
printf("Enter the tax exempted amount: ");
scanf("%lf", &exemptedAmt);
NTI = income - exemptedAmt;
if(NTI < 2500)
tax = 0;
else if(NTI >= 2500 && NTI < 5000)
tax = 100 + (3*(NTI - 2500)) / 100;
else if(NTI >= 5000 && NTI < 10000)
tax = 175 + (5*(NTI - 5000)) / 100;
else if(NTI >= 10000 && NTI < 25000)
tax = 425 + (8*(NTI - 10000)) /100;
else if(NTI >= 25000 && NTI < 50000)
tax = 1625 + (13*(NTI - 25000)) / 100;
else if(NTI >= 50000)
tax = 4875 + (25*(NTI - 50000)) / 100;
printf(" Gross income %.2lf ", income);
printf("Tax exempted income: %.2lf ", exemptedAmt);
printf("Net Taxable Income: %.2lf ", NTI);
printf(" *** The Total tax due is : %.2lf ***", tax);
}
Program #1#include<stdio.h>
int main()
{
int num;
printf("Enter an integer: ");
scanf("%d", &num);
if(num % 2 == 0)
printf("Input number is even.");
else
printf("Input number is odd.");
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.