1. The document describes a menu-driven program with 5 options: input N and M, display a rectangle with numbers based on N and M, calculate the total of prime numbers in the rectangle, calculate the total of numbers in the last column, and exit.
2. It provides details on how each option should be coded as a separate function, including any arguments passed and return values.
3. It also includes a separate question to write a program that accepts N strings, stores them in an array, and displays the strings, number of even length strings, and list of even strings.
This document provides instructions for an assignment in elementary C programming. It outlines 3 questions to code as separate C files saved in a specific folder structure. Question 1 checks if a number is a perfect square. Question 2 creates a menu-driven program to input and manipulate an array, performing operations like finding max odd number. Question 3 prints a pattern of asterisks in N rows based on an odd number N input by the user.
4. 214
printf("n");
getch();
printf("Phuong phap Euler cai tienn");
printf(" x y");
printf("n");
for (i=1;i<=n+1;i++)
{
x[i+1]=x[i]+h;
c1=h*f(x[i],y[i]);
c2=h*f(x[i]+h,y[i]+c1);
y[i+1]=y[i]+(c1+c2)/2;
printf("%3.2f%15.5f",x[i],y[i]);
printf("n");
}
getch();
}
Víi ph−¬ng tr×nh cho trong function vµ ®iÒu kiÖn ®Çu xo = 0,yo= 0, nghiÖm trong
®o¹n [0,1] víi 10 ®iÓm chia lµ :
x y(Euler) y(Euler c¶i tiÕn)
0.0 0.00 0.00
0.1 0.00 0.01
0.2 0.01 0.02
0.3 0.03 0.05
0.4 0.06 0.09
0.5 0.11 0.15
0.6 0.17 0.22
0.7 0.25 0.31
0.8 0.34 0.42
0.9 0.46 0.56
1.0 0.59 0.71
§3.Ph−¬ng ph¸p Runge-Kutta
XÐt bµi to¸n Cauchy (1).Gi¶ sö ta ®· t×m ®−îc gi¸ trÞ gÇn ®óng yi cña y(xi) vµ muèn
tÝnh yi+1 cña y(xi+1).Tr−íc hÕt ta viÕt c«ng thøc Taylor :
i i i i
m
i
m
y x y x hy x h y x h
m
y x
h
m
ym m
+
+
= + + + + + +
′ ′′
+1
2 1
2 1
1
( ) ( ) ( ) ( )
! ( )
( )! (c)... ( ) ( )
( ) (11)
víi c ∈(xi,xi+1) vµ :
i i i
y x f x y x′ =( ) [ ( )],
( )
( ) [ ( ( )],
k
i
k
ky x d
dx
f x y x ix x
=
=
−
−
1
1
Ta viÕt l¹i (11) d−íi d¹ng :
i i i i
m
i
m
m
m
y y hy h y h
m
y h
m
y+
+
+
− = + + + +
+1
2 1
1
2 1
, ,, ( )
( )
( )
...
! ( )!
(c)
(12)
Ta ®· kÐo dµi khai triÓn Taylor ®Ó kÕt qu¶ chÝnh x¸c h¬n.§Ó tÝnh y′i,y″i v.v.ta cã thÓ dïng
ph−¬ng ph¸p Runge-Kutta b»ng c¸ch ®Æt :