From 0c9cd42366fcf3190cb4b1f9d303172ca3039e09 Mon Sep 17 00:00:00 2001 From: hyper-crazy Date: Tue, 6 Jan 2026 10:31:58 +0600 Subject: [PATCH 1/2] LabTest --- labtest.cpp | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/labtest.cpp b/labtest.cpp index 93bf6ae..89368ab 100644 --- a/labtest.cpp +++ b/labtest.cpp @@ -1,20 +1,37 @@ -#include +#include using namespace std; -//write a user defined function to find first N prime numbers; -//the function should be named like : youname_yourid; -/* -example: +// user-defined function to find first N prime numbers +void morshedul_221400036(int n) { + int count = 0; -void nishat_90(int n){ -//your code here; -} -*/ + for (int num = 2; count < n; num++) { + bool isPrime = true; -int main(){ + for (int i = 2; i * i <= num; i++) { + if (num % i == 0) { + isPrime = false; + break; + } + } + if (isPrime) { + cout << num << " "; + count++; + } + } +} +int main() { int n; - cout<<"Enter the number n"<>n; + cout << "Enter the number n" << endl; + cin >> n; + + if (n <= 0) { + cout << "Please enter a positive number."; + return 0; + } + + morshedul_221400036(n); + return 0; } From c616d0670879100fa012cf072e4dddb6a2a1d253 Mon Sep 17 00:00:00 2001 From: hyper-crazy Date: Tue, 6 Jan 2026 10:33:43 +0600 Subject: [PATCH 2/2] LabTest --- labtest.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/labtest.cpp b/labtest.cpp index 89368ab..0f07cba 100644 --- a/labtest.cpp +++ b/labtest.cpp @@ -2,7 +2,7 @@ using namespace std; // user-defined function to find first N prime numbers -void morshedul_221400036(int n) { +void morshedulislam_221400036(int n) { int count = 0; for (int num = 2; count < n; num++) { @@ -32,6 +32,6 @@ int main() { return 0; } - morshedul_221400036(n); + morshedulislam_221400036(n); return 0; }