Posts

Showing posts from May, 2018

Write a program to input speed of Royal Enfield and check it's running at economic speed or not.

Image
About Program  In this program we input a speed of Royal Enfield or any bike or car anything. In short we input a speed and check what is status of its speed means, is bike at economic speed???         For this program, logic is if speed less than 80 then we can say bike run at economic speed else this condition is false then we can say bike not run at economic speed. Let's Begin --  #include<stdio.h> #include<conio.h> void main() { int s; clrscr(); printf("Enter speed of Royal Enfield="); scanf("%d",&s); if(s<80)  printf("\nRunning at economic speed"); else  printf("\nNot Running at economic speed "); getch(); } OUTPUT   Enter speed of Royal Enfield=76 Running at economic speed                          OR Enter speed of Royal Enfield=84 Not Running at economic speed Related Examples  Write a program to input length and ...

Write a program to input length and width of a shape and find shape is square or rectangle.

Image
About Program In this program we input length and width of a shape and check what kind of shape.    To understand this program you should knowledge of some basic conditional statements (if-else) program. Some Basic conditional statements programs are below.    If length and width of shape is same then we print Square else print Rectangle. #include<stdio.h> #include<conio.h> void main() { int l,w; clrscr(); printf("Enter length and width of shape="); scanf("%d%d",&l,&w); if(l==w)  printf("\nShape is Square"); else  printf("\nShape is Rectangle"); getch(); } OUTPUT Enter length and width of shape=5 5 Shape is Square                   OR Enter length and width of shape=5 6 Shape is Rectangle Related Examples  Write a program to input sell price and cost price and find transaction is profit or loss.  Write a program to input a number and check number ...

Write a program to input sell price and cost price and find transaction is profit or loss.

Image
About Program  In this program we input sell price and cost price of a product and calculate what happened in this transaction, profit or loss. For this we need a condition which describe in if block. If sell price is greater than cost price then transaction is profit else loss. #include<stdio.h> #include<conio.h> void main() { int sp,cp; clrscr(); printf("Enter sell price and cost price="); scanf("%d%d,&sp,&cp); if(sp>cp)  printf("\nTransaction in Profit"); else   printf("\nTransaction in Loss"); getch(); } OUTPUT   Enter sell price and cost price=500 400 Transaction in Profit               OR Enter sell price and cost price=400 500 Transaction in Loss Related Examples  Write a program to input age of any person and check he is eligible for voting or not. Write a program to input a number and check number is odd or even. Write a program to input two number and fin...

Write a program to input age of any person and check he is eligible for voting or not.

Image
In this program we input age of any person and check he is eligible for voting or not means we input a number by user and check number is greater than and equal to 18 then he is eligible for voting else not. So let's start #include<stdio.h> #include<conio.h> void main() { int a; clrscr(); printf("Enter age of person="); scanf("%d",&a); if(a>=18)   printf("\nEligible for voting"); else   printf("\nNot eligible for voting"); getch(); } RELATED EXAMPLES  Write a program to input age of an employee and check he is retired or working . Write a program to input a number and check number is odd or even. Write a program to input two number and find smallest number .   Write a program to input two number and find highest number.   Share and Comment.  Follow for recently updates.

Write a program to input age of an employee and check he is retired or working.

Image
In this program we input age of an employee and check his status means he is Working or Retired.     For this program we input an employee age by user and check if age is greater than 60 then we print Retired else Print Working.    This is conditional statements program. For learn this program you should basic knowledge of conditional statements. Learn basic see if-else programs. #include<stdio.h> #include<conio.h> void main() { int a; clrscr(); printf("Enter employee age="); scanf("%d",&a); if(a>=60)  printf("\nRetired"); else  printf("\nWorking"); getch(); } OUTPUT  Enter employee age=65 Retired              OR Enter employee age=55 Working Related Examples Write a program to input an year and check year is leap or not.  Write a program to input a number and check number is odd or even. Write a program to input two number and find smallest number .  ...

Write program to input year and check year is leap or not.

Image
In this program we input an year and check year is leap or not, that means we input a year by user and then he find Leap year if condition is true else Not leap year.    As we know leap year means that year which divided by 4. In program we write a condition that if year fully divided by 4 then Leap year else Not leap year.    Let's Begin -- #include<stdio.h> #include<conio.h> void main() { int y; clrscr(); printf("Enter a year="); scanf("%d",&y); if(y%4==0)  printf("\nLeap year"); else  printf("\nNot leap year"); getch(); } OUTPUT   Enter a year=2001 Not leap year                     OR Enter a year=2016 Leap year Related Examples  Write a program to input a number and check number is odd or even. Write a program to input two number and find smallest number .  Write a program to input two number and find highest number.  ...

Write program to input a number and check number is odd or even.

Image
In this program we input a number and check number is odd or even means if number is devide by 2 then we can say number is even number else odd number. For learn this program you should knowledge of some simple conditional programs. That's link below. #include<stdio.h> #include<conio.h> void main() { int n; clrscr(); printf("Enter a number="); scanf("%d",&n); if(n%2==0)   printf("Even number"); else   printf("Odd number"); getch(); } OUTPUT  Enter a number=5 Odd number               Or Enter a number=4 Even number Related Examples  Write a program to input two number and find the highest number. Write a program to input two number and find the smallest number. Write a program to input a number and check number is positive,negative or nuteral.  Write a program to input a number and check number is negative or not . Write a program to input a number and check number is positiv...