c++
Classified in Computers
Written at on English with a size of 4.14 KB.
Write a program to convert a
Numerical grade to text:
0.0 ≤ X < 5.0 è Fail
5.0 ≤ X < 7.0 è Pass
7.0 ≤ X < 9.0 è Good
9.0 ≤ X < 10.0 è Excellent
X=10.0 è With Honors
Check that the grade is valid, and If not, print a message that explains the error and finishes the program.
Write a C program to
accept the Coordinates (X, Y) of a point and determine in which quadrant the point lies.
#include<stdio.H>
int main()
{
float x, y;
printf("enter the coordinate x\n" );
scanf("%f",&x);
printf("enter the coordinate y\n" );
scanf("%f",&y);
if(x>0 && y>0)
printf("first quadrant \n");
if(x<0 && y>0)
printf("second quadrant \n");
if(x<0 && y<0)
printf("third quadrant \n");
if(x>0 && y<0)
printf("fourth quadrant \n");
if(x==0 && y==0)
printf("center \n");
}
Write a Program to print a table of Fahrenheit temperatures and their centigrade or Celsius equivalents (from 0°C to 100°C step 5).
#include<stdio.H>
int main()
{
float C=0.0, F=0.0;
printf("table from Fahrenheit to Celsius \n");
for (C>=0;C<=100;C=C+5){
F=C*(9/5)+32;
printf(" The value %g in Celsius corresponds to%g in Fahrenheit \n", C,F);
}
}