Posts

Write a program to input three digit number and check number is palindrome or not.

Image
Program in C Language  About Program :-  Here we will learn C Language through a basics. Programming in C is a very easy if you understand its logic. Here we input 3 number and check its palindrome or not.            First we use printf for print a messege to user and ask three number and we take input by using scanf and finally after this logic section. First we break its digit like 235 to 2,3,5 and check 1st and 3rd are equal or not.        If 1st and 3rd digit are equal then enter number is palindrome or not. So let's see code..... #include<stdio.h> #include<conio.h> void main() { int n,a,b; clrscr(); printf("Enter a 3 digit number="); scanf("%d",&n); a=n/100; b=n%10; if(a==b)   printf("\nThis is Palindrome "); else   printf("\nThis is not Palindrome "); getch(); } OUTPUT Enter a 3 digit number=232 This is Palindrome           ...

Write a program to check age of any student is teen age or not.

Image
Programming in C Language... About program -- In this program we input age of a student and check he is teen ager or not. In details , If age is greater and equal to 13 and less than and equal to 19 then we can say , student is teen ager and if this condition is false then we print that student is not teen ager. #include<stdio.h> #include<conio.h> void main() { int a; clrscr(); printf("Enter age of student="); scanf("%d",&a); if(a>=13 && a<=19) printf("\nThis is teen ager"); else printf("\nThis is not teen ager"); getch(); } OUTPUT Enter age of student=19 This is teen ager                  Or Enter age of student=23 This is not teen ager Write a program to input two digit number and check number is palindrome or not. Write a program to input speed of Royal Enfield and check it's running at economic speed or not. Write a program to input length and width of a shape and find sha...

Write a program to input two digit number and check number is palindrome or not.

Image
ABOUT PROGRAM In this program we input a two digit number and check number is palindrome(a number which read by both side) or not. For this program we use if else statement and you should knowledge of some basic conditional statements program. So check last program.            First,we should 1st digit by using division and 2nd digit by using modular and at the end we check that both digits or equal or not. If both are equal then we print this is palindrome or not.  #include<stdio.h> #include<conio.h> void main() { int n,a,b; clrscr(); printf("Enter two digit number="); scanf("%d",&n); a=n/10; b=n%10; if(a==b)  printf("\nThis is Palindrome"); else  printf("\nNot Palindrome number"); getch(); } OUTPUT  Enter two digit number=66 This is Palindrome                     OR Enter two digit number=65 Not Palindrome number Related Examples...

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.