C语言完善程序

C语言完善程序,第1张

#include <stdio.h>

main()

{

    int ch1, ch2

    while ((ch1 = getchar()) != EOF)

    弯拍    if (ch1>='a'&&ch1<='z')

        {

            稿姿ch2 = ch1 - 32

            putchar(ch2)

        }

        else

         键闹绝   putchar(ch1)

}

#include <stdio.h>

int main()

{

float cost,percent,c

printf("肢则戚请输历陵入商品的原价(单盯纯位:元)");

scanf("%f",&cost)/*第一空*/

printf("请输入折扣率:")

scanf("%f",&percent)

c=cost*percent

printf("实际售价为:%0.2f ",c)

}

#include <指渗stdio.h>

void swap (int *, int *)

void main (void)

{

int x,y

scanf("%d%d", &x, &y)

swap(&x,&y)

printf("%d, %d\n", x,y)

}

void swap(int * a,int * b)

{

int t

t=*a

*a=*b

*b=t

}

#include <stdio.h>

void main (void)

{

int i

float scoer[36], precent

int count=0

for (i=0i<36i++)

{

scanf("%f",&scoer[i])

if(scoer[i]<60)

count++

}

precent=count/36.0

printf("不及物逗知格人数:%d,不及格比例:%f\罩消n",count,precent)

}

#include <stdio.h>

#include <stdlib.h>

void main (void)

{

char str[80]

int i, iA=0, ia=0, iother=0

gets(str)

i=0

while(str[i]!='\0')

{

if(str[i]<='z'&&str[i]>='a')

ia++

else if(str[i]<='Z'&&str[i]>='A')

iA++

else

iother++

i++

}

printf("%d %d %d\n",iA,ia,iother)

}

#include <stdio.h>

void main(void)

{

int a[3][3]={1,3,5,7,9,11,13,15,11}

int i,j,s1,s2

int t[3][3]

s1=a[0][0]+a[1][1]+a[2][2]

s2=a[0][2]+a[1][1]+a[2][0]

printf("%d, %d,\n",s1, s2)

for(i=0i<3i++)

for(j=0j<3j++)

t[i][j]=a[j][i]

for(i=0i<3i++)

for(j=0j<3j++)

printf("%d ",t[i][j])

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://www.outofmemory.cn/yw/12482573.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-25
下一篇 2023-05-25

发表评论

登录后才能评论

评论列表(0条)

保存