Posts

Write a program to input two number and find smallest number.

Image
In this program we input two number and check which number is smallest. For this, we give a condition As:- If 1st number is smallest then print 1st number else 2nd number is smallest and print 2nd number. #include<stdio.h> #include<conio.h> void main() { int a,b; clrscr(); printf("Enter 1st number="); scanf("%d",&a); printf("Enter 2nd number="); scanf("%d",&b); if(a<b) printf("\n1st number is smallest"); else printf("\n2nd number is smallest"); getch(); } OUTPUT   Enter 1st number=7 Enter 2nd number =10 1st number is smallest Related Examples  Write a program to input a number and check number is positive or not. 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 positive,negative or nuteral. Write a program to input two number and find highest number.  Follow for recently updates ,Share...

Write a program to input two number and find highest number.

Image
In this program we input two number and check which number is highest. For this, we give a condition As:- If 1st number is highest then print 1st number else 2nd number is highest and print 2nd number. #include<stdio.h> #include<conio.h> void main() { int a,b; clrscr(); printf("Enter 1st number="); scanf("%d",&a); printf("Enter 2nd number="); scanf("%d",&b); if(a>b) printf("\n1st number is highest"); else printf("\n2nd number is highest"); getch(); } OUTPUT   Enter 1st number=9 Enter 2nd number =7 1st number is highest Related Examples  Write a program to input a number and check number is positive or not. 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 positive,negative or nuteral.   Follow for recently updates ,Share and Comment. 

Write a program to input a number and check number is positive,negative or nuteral.

Image
In this program input a number and check number is positive, negative or nuteral. If number is greater than Zero then print positive , if less than zero then print negative and if both condition false then print nuteral. #include<stdio.h> #include<conio.h> void main() { int n; clrscr(); printf("Enter a number="); scanf("%d",&n); if(n>0) printf("Positive number"); else if(n<0) printf("Negative number"); else printf("Nuteral"); getch(); } OUTPUT  Enter a number=4 Positive number                Or Enter a number=-4 Negative number                Or Enter a number=0 Nuteral Related Examples  1. Write a program to input a number and check number is positive or not. 2. Write a program to input a number and check number is negative or not.  Follow for recently updates on Google+ or subscribe. 

Write a program to input a number and check number is negative or not.

Image
In this program we input a number and check number is negative or not means if number is less than Zero then number is negative or not. #include<stdio.h> #include<conio.h> void main() { int n; clrscr(); printf("Enter a number="); scanf("%d",&n); if(n<0) printf("\nNegative number"); else printf("Not negative number"); getch(); } OUTPUT  You can follow me on Google+. Subscribe for recently updates. 

Write a Program to input a number and check number is positive or not.

Image
In this program we input a number and check number is positive or not. If number is greater than Zero, then number is positive. #include<stdio.h> #include<conio.h> void main() { int n; clrscr(); printf("Enter a number="); scanf("%d",&n); if(n>0) printf("Positive number"); else printf("Not positive number"); getch(); } Follow for recently updates. 

Program to input three number and print their Reverse.

Image
In this program we input three numbers and print their Reverse. First we find 1st digit by (n/100), 2nd digit by(n/10)%10 and 3rd digit by (n%10). Then finally we add a program logic. #include<stdio.h> #include<conio.h> void main() { int n,d1,d2,d3,r=0; clrscr(); printf("Enter three digit number="); scanf("%d",&n); d1=(n/100); d2=(n/10)%10; d3=n%10; r=(d3*100)+(d2*10)+d1; printf("\nReverse of number=%d",r); getch(); } OUTPUT 

Program to input three number and print their sum of digits in C.

Image
In this program we input three numbers and print their sum of digit. First we find 1st digit by (n/100), 2nd digit by(n/10)%10 and 3rd digit by (n%10). Then finally sum of digits. #include<stdio.h> #include<conio.h> void main() { int n,d1,d2,d3,s=0; clrscr(); printf("Enter three digit number="); scanf("%d",&n); d1=(n/100); d2=(n/10)%10; d3=n%10; s=d1+d2+d3; printf("\nSum of digits=%d",s); getch(); } OUTPUT