1-write a program in c language to find greater in between two number using if-else condition.
if-else program |
#include < stdio.h>
#include< conio.h>
void main()
{
Int a=4,b=9;
clrscr();
If (a>b)
{
Printf(“a is grater than b”);
}
else
Printf(“b is grater than a”);
getch();
}
Output:- b is grater than a
Write a C-language program for Addition,Substraction,Multiplication and Division.
2- write a c-language program using if- else condition to find your age is eligble for voting or not.
#include < stdio.h>
#include< conio.h>
void main()
{
Int age;
clrscr();
Printf(“please enter your age:”);
Scanf(“%d”,&age);
If (age>=18)
{
Printf (“you are eligible for voting”);
}
else
{
Printf(“you are not eligible for voting”);
}
getch();
}
Output:-
please enter your age: 21
you are eligible for voting
3-Write a program in C- language to find odd and even number using if-else condition.
#include<stdio.h>
#include<conio.h>
int main()
{
int number;
clrscr();
printf(“Enter a number:-”);
scanf(“%d”,&number);
if (number%2 == 0)
{
printf(“%d is an even Number”, number);
}
else
{
printf (“%d is an odd number”, number);
}
getch();
}
Output:- Enter a number:- 4
4 is an even Number
4-Write a C- language program to relate two integers using =, > or < symbol.
#include<stdio.h>
#include<conio.h>
Void main()
{
Int num1, num2;
clrscr();
printf(“Enter Two Numbers:-“);
scanf(“%d %d”,&num1,&num2);
if(num1= = num2)
{
Printf( “Result: %d= %d”,num1,num2);
}
else if (num1> num2)
{
Printf( “Result: %d> %d”,num1,num2);
}
else
{
Printf( “Result: %d< %d”,num1,num2);
}
getch();
}
Output:- Enter Two Numbers:- 12 25
Result: 12 < 25
c program to arrange 3- numbers in ascending order without using array.
5-write a program in c++ to find greater in between two number using if-else condition.
#include < iostream.h >
Using namespace std;
void main()
{
Int n=4,m=9;
clrscr();
If (n>m)
{
Printf(“n is grater than m”);
}
else
Printf(“n is grater than m”);
return 0;
}
Output:- m is grater than n
Write a C- program to compute the circumference of a circle and area of circle.
0 Comments