Beg 1*2*3*4*5#include <stdio.h>int Main () {int I;int sum = 1;for (i = 1; I <= 5; i++) {sum = sum * i;} printf ("1*2*3*4*5 value is:%d\n", sum); return 0;}
There are 50 students, who require the output score of 80 points or more students of the student's number and score//for the input simple set for 5 students Ah # # # # # <stdio.h>int Main () {int i;int arr[5];p rintf ("Please enter a batch of scores: \ n "); for (i = 0; I < 5; i++) {scanf ("%d", &arr[i]), if (Arr[i] >=) {printf ("study number:%d score:%d", i+1,arr[i]);}} return 0;}
Determines whether each year in 2000-2,500 is a leap years and outputs the result of # include <stdio.h>int main () {int i;printf ("Enter a year:"), scanf ("%d", &i), if (i >= && i <= 2500) {if ((i% 4 = = 0 && i% = 0) | | I% = = 0) printf ("%d is a leap year \ n", i); elsep rintf ("%d is not a leap year \ n", i);} ELSEPRINTF ("The year you entered is not in range, please re-enter \ n"); return 0;}
Beg 1-1/2+1/3-1/4...+1/99-1/100#include <stdio.h>int Main () {Double A = 1.0;int i;double sum = 1.0;for (i = 2; i < = 100; i++) {a = ( -1) * a;sum = sum + a/i;} printf ("1-1/2+1/3-1/4...+1/99-1/100=%f\n", sum); return 0;}
Give a positive integer greater than or equal to 3 to determine if it is a prime number # include <stdio.h> #include <math.h>int sushu (int x) {int i;if (x >= 3) {for (i = 2; I <= sqrt (x); i++) {if (x% i = = 0) return 1;elsereturn-1;}} elseprintf ("The number entered is too small, please re-enter \ n");} int main () {int a;int b;printf ("Please enter a number:"), scanf ("%d", &a), B = Sushu (a), if (b = = 1) printf ("%d is not prime \ n", a); elseprintf ("% D is the prime number \ n ", a); return 0;}
"C Language" C programming--Rectification--(chapter II)--1