Project 13 a. Write an AL algorithm which checks an arbitrary pair-wise numbers
ID: 3689040 • Letter: P
Question
Project 13
a. Write an AL algorithm which checks an arbitrary pair-wise numbers to determine if they are a pair-wise prime numbers.
PLEASE WRITE IN PSEUDOCODE FIRST
Note:
1. Definition of prime numbers: A positive integer number N > 1 is said to be a prime number if N mod(k) / 0 only for k = 1 and k = N.
Definition of a pair-wise odd sequence: An infinite pair of numbers (2N + 1, 2N + 3); N = 1, 2, 3, ....
Definition of pair- wise prime Numbers: Those number pairs in the above sequence where both numbers are prime. Examples: (3,5), (5,7), (11, 13), ...
Explanation / Answer
Pseudocode to find the given pairwise number a primepair
i) declare a char array as string char instring[5];
ii) ask input from the user for the instring
iii) the second and fourth inputs of the string in char instring is the numbers to be checked as prime numbers
iv) bymeans of atoi function convert the string to numbers
v) call the function to check the prime numbers
vi) function to check is prime is as follows
program
#include <stdio.h>
#include <conio.h>
int main(){
char inString[20];
int num[2],temp
printf("Enter a pairwise integers to find if they are prime pairs ");
gets(inString);
num[1] = atoi(inString[2]);
num[2] = atoi(inString[4]);
printf("Integer: %d ", num);
for(int i=2;i<=num/2;i++)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.