首页
/
每日頭條
/
教育
/
編程題計算圓的面積或周長
編程題計算圓的面積或周長
更新时间:2024-10-01 02:15:48

時間限制: 1 Sec 内存限制: 128 MB

題目描述

輸入一個長方形的長和寬,計算其周長和面積

輸入

輸入兩個數,表示長和寬

輸出

輸出第一行是周長

第二行是面積

編程題計算圓的面積或周長(小學入門級C題目1011:)1

面積

編程題計算圓的面積或周長(小學入門級C題目1011:)2

周長

樣例輸入

4 2

樣例輸出

12

8

編程題計算圓的面積或周長(小學入門級C題目1011:)3

答案在下方

答案:

#include<iostream>

#include<cstdio>

using namespace std;

int main(){

int a,b,c,s;

scanf("%d%d",&a,&b);

c=(a b)*2;

s=a*b;

printf("%d\n%d",c,s);

return 0;

}

,
Comments
Welcome to tft每日頭條 comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments
Copyright 2023-2024 - www.tftnews.com All Rights Reserved