zoukankan      html  css  js  c++  java
  • 第三,四章

    # include<stdio.h>
    int main(void)
    {
     
       printf("Progmming is fun.
    ");
        printf("And programming in C is even more fun!
    ");
    
    
        return 0;
    }

    #include<stdio.h>
    int main(void)
    {
        int celsius,fahr;
    
        fahr=100;
        celsius = 5 * (fahr-32)/9;
    
        printf("fahr=%d,celsius = %d
    ",fahr,celsius);
    
        return 0;
        
    }

    #include <stdio.h>
    int main(void)
    {
        double x,y;
    
        printf("Enterx(x>=0;
    ");
        
    	scanf("%if",&x);
    	if(x<=15){
            y=4*x/3;
        }
    	else {
    		y=2.5*x-10.5; 
    	}
    	printf("y=f(%f)=%.2f
    ",x,y);
    
       return 0;
    }
    

     

    #include<stdio.h>
    #include<math.h>
    
    int main(void)
    {
    	int money,year;
    	double rate,sum;
    
    	 printf("Enter money:");
              scanf("%d",&money);
    	printf("Enter year:");
    	scanf("%d",&year);
    	printf("Enter rate:");
    	scanf("%if",&rate);
    	sum=money * pow(1+rate,year);
    	printf("sum=%.2f
    ",sum);
    
    	return 0;
    }
    

     

      

    #include<stdio.h>
    int main(void)
    {
     int fahr,lower,upper;
     double celsius;
    
     printf("Enter lowor:");
     scanf("%d",&lower);
        printf("Enter upper:");
     scanf("%d",&upper);
     printf("fahr  celsius
    ");
    
     
      for(fahr=lower;fahr<=upper;fahr++){
       celsius=(5.0/9.0)*(fahr-32);
       printf("5d%6.1f
    ",fahr,celsius);
            }
    
    
    
    #include<stdio.h>
    int main(void)
    {
        int i,n,sum;
    
        printf("Enter n:");
        scanf("%d",&n);
        sum=0;
        for(i=1;i<=n;i++){
            sum=sum+i;
        }
        printf("Sum of numbers from 1 to %d is %d
    ",n,sum);
    
        return 0;
    }

    #include<stdio.h>
    int main(void)
    {
        int denominator,flag,i,n;
        double item,sum;
    
        printf("Enter n:");
        scanf("%d",&n);
        flag=1;
        denominator=1;
        sum=0;
        for(i=1;i<=n;i++){
            item=flag*1.0/denominator;
            sum=sum+item;
            flag=-flag;
            denominator=denominator+2;
        }
        printf("sum=%f
    ",sum);
    
        return 0;
    }

     

    #include<stdio.h>
    int main(void)
    {
        int i,n;
        double product;
    
        printf("Enter n:");
        scanf("%d",&n);
        product=1;
        for(i=1;i<=n;i++){
            product=product*i;
        }
        printf("product=%.0f
    ",product);
    
        return 0;
    
    }

  • 相关阅读:
    vue-element 时间选择器datepicker 第二次展示change无效,数据刷新页面不刷新
    uniapp
    mysql
    python
    pycharm
    从maven的debug compile到java的编译时注解(与springboot项目整合)
    关于H5+实现APP检查自动更新与 调用 plus.runtime.install 弹出不了安装界面问题
    Linux常用命令
    mybatis中sql语句必须用${}而不能不用#{}的情况
    Mybatis映射文件中的参数传递
  • 原文地址:https://www.cnblogs.com/wangyanchao1994/p/3355456.html
Copyright © 2011-2022 走看看