#include <stdio.h>//1. TrianglesintMain () {printf ("*\n"); printf ("**\n"); printf ("***\n"); printf ("****\n"); printf ("*****\n"); printf ("******\n"); printf ("*******\n"); printf ("********\n"); printf ("*********\n"); printf ("**********\n"); }
#include <stdio.h>//3. Inverted triangleintMain () {printf ("**********\n"); printf ("*********\n"); printf ("********\n"); printf ("*******\n"); printf ("******\n"); printf ("*****\n"); printf ("****\n"); printf ("***\n"); printf ("**\n"); printf ("*\n"); return 0 ; }
#include <stdio.h>//2.10-row RectangleintMain () {printf ("**********\n"); printf ("**********\n"); printf ("**********\n"); printf ("**********\n"); printf ("**********\n"); printf ("**********\n"); printf ("**********\n"); printf ("**********\n"); printf ("**********\n"); printf ("**********\n");}
#include <stdio.h>intMain ()//five grades (a~e), output corresponding percentile score (0~100) interval{ Charscore; scanf ("%c",&score); Switch(score) { Case 'A': printf ("90~100"); Break; Case 'B': printf ("80~89"); Break; Case 'C': printf ("70~79"); Break; Case 'D': printf ("60~69"); Break; Case 'E': printf ("0~59"); Break; } return 0;}
int main () {int f=; int C; C= (5* (f-C)/9); printf ("%d", C); return 0 ;}
#include <stdio.h>int main ()//100 m freefall { int g= ; int t=3; int height; Height=0.5*g*t*t; printf ("height=%d", height); return 0 ;}
#include <stdio.h>intMain ()//Single-digit , 10-digit, and hundred-digit values for output integers{ intA; scanf ("%d",&a); while(a!=0) {printf ("%d\n", a%Ten); A=a/Ten; } return 0;}
#include <stdio.h>#include<math.h>intMain ()//segment Function{ Doublex; Doubley; scanf ("%LF",&x); if(x>=0) y=sqrt (x); Elsey=pow (x+1,2)+2*x+1/x;printf ("f (x) =%f", y);return 0; }
#include <stdio.h>#include<math.h>intMain ()//calculate interest on deposit{ intYear,money; Doublerate,interest; printf ("Please enter the deposit period"); scanf ("%d",&Year ); printf ("Please enter your deposit amount"); scanf ("%d",&Money ); printf ("Please enter annual interest rate"); scanf ("%LF",&Rate ); Interest=money*pow (1+rate,year)-Money ; printf ("interest is%f", interest);return 0;}
#include <stdio.h>#include<math.h>intMain ()//Calculate electricity bills{ Doublex, y; scanf ("%LF",&x); if(x<= -) y=0.53*x; Elsey=0.53* -+ (X- -)*0.58; printf ("Electricity =%f", y); return 0; }
C-language third time job