Tuesday, December 30, 2014

Math(3)

1:
 #include <stdio.h>
///***celsius-farenheit 
 int main()  
 {  
     double celsius, farenheit;  
     printf("Enter the temperature in celsius: ");  
     scanf("%lf", &celsius);  
     farenheit = 1.8 * celsius + 32;  
     printf("Temperature in farenheit is: %.2lf\n", farenheit);  
     return 0;  
 }

output:   depend on your value

2:
#include<stdio.h>
///***L.C.M
int main(){
    int x,y,m,i;
    printf("Insert any two number: ");
    scanf("%d%d",&x,&y);
     if(x>y)
          m=y;
     else
          m=x;
     for(i=m;i>=1;i--){
          if(x%i==0&&y%i==0){
              printf("L.C.M of two number is : %d",x*y/i) ;
              break;
          }
     }
     return 0;
 }


output:   depend on your value

3:
#include<stdio.h>
///***G.C.D
int main(){
    int x,y,m,i;
    printf("Insert any two number: ");
    scanf("%d%d",&x,&y);
     if(x>y)
          m=y;
     else
          m=x;
     for(i=m;i>=1;i--){
          if(x%i==0&&y%i==0){
              printf("GCD of two number is : %d",i) ;
              break;
          }
     }
     return 0;
 }



output:   depend on your value





 

No comments:

Post a Comment