Write a C program to accept two integers and check whether
they are equal or not.
Input : 15 15
Output : Number1 and Number2 are equal
#include <stdio.h>
#include <stdlib.h>
int grade(int a, int b){
if(a==b)
printf("Two number are equal: \n");
else
printf("Two number are unequal: \n");
return 0;
}
int main(){
int x,y;
printf("Enter two number: ");
scanf("%d%d", &x, &y);
grade(x,y);
return 0;
}
Write a C program to check whether a given number is positive or negative
#include <stdio.h>
#include <stdlib.h>
int grade(int a){
if(a>0)
printf("The number is positive: \n");
else
printf("The number is negative: \n");
return 0;
}
int main(){
int x;
printf("Enter two number: ");
scanf("%d", &x);
grade(x);
return 0;
}
Write a C program to calculate profit and loss on a transaction
int grade(int a, int b){
if(a>b)
printf("profit: %d", a-b);
else if(b>a)
printf("loss: %d", b-a);
else
printf(" no profit and no loss: ", a==b);
return 0;
}
int main(){
int x,y;
printf("Enter two number: ");
scanf("%d%d", &x, &y);
grade(x,y);
return 0;
}
Write a C program to check whether a triangle can be formed by the
given value for the angles
#include <stdio.h>
#include <stdlib.h>
int grade(int a, int b, int c){
if(a+b+c==180)
printf("The triangle can be formed: \n");
else
printf("The triangle cant be formed: \n");
return 0;
}
int main(){
int x, y, z;
printf("Enter three values: ");
scanf("%d%d%d", &x, &y, &z);
grade(x,y,z);
return 0;
}