Write A Program To Calculate All The Prime Numbers of Inputs Entered by The User
Write A Program To Calculate All The Prime Numbers of Inputs Entered by The User
1. Write a program to calculate all the prime numbers of inputs entered by the user.
2. Write a function to determine if a number is prime, if it is prime, return 1 else return 0.
Multidimension arrays:
This is an array with rows and columns. E.g. 2D arrays. It is represented as: 0 1 2 3
0 9 3 -4 9
1. Definition 1 7 11 17 10
2. Illustration 2 14 0 19 12
3. Declaration 3 20 18 17 3
4. Traversing {
For (i=0; i<N; i++) { M [1][2] = 17;
For (j= 0; j<N; j++) {
Write(M[i][j];
}
}
Int [4][4]
Char me [10][15];
Examples of application:
Write a program that adds 2 ,2 by 2 metrices given by a user
Exercise
• Write a program that collect the two by two matrix of the user and display it’s
determinant.
• Write a program that add two n by n metrices given by the user.
• Write a program that calculate the determinants of two by two matrix.
• NB: you may a function called det2 which returns the determents of a two by
two matrix.
• Look for the determinant of a three by three matrix
Assignment:
Make notes on struct data structure.