Question: write a c code using onlinegdb.com, and the following code that I started please help me get the required output. Please show proof of SCREENSHOTS

write a c code using onlinegdb.com, and the following code that I started please help me get the required output. Please show proof of SCREENSHOTS of the OUTPUT working!
#include
#include
#include
#include
#include
volatile int largest_prime =2;
volatile int quit_flag =0;
// Function to check if a number is prime
int is_prime(int num){
if (num =1) return 0;
if (num =3) return 1;
if (num %2==0|| num %3==0) return 0;
for (int i =5; i * i = num; i +=6){
if (num % i ==0|| num %(i +2)==0) return 0;
}
return 1;
}
// Signal handler for SIGINT
void handle_sigint(int sig){
printf("
%d Quit [y/n]?", largest_prime);
char choice;
struct termios oldt, newt;
tcgetattr(STDIN_FILENO, &oldt);
newt = oldt;
newt.c_lflag &= ~(ICANON | ECHO);
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
choice = getchar();
tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
if (choice =='y'|| choice =='Y'){
quit_flag =1;
}
}
// Main function
int main(){
signal(SIGINT, handle_sigint);
int num =2;
while (!quit_flag){
if (is_prime(num)){
largest_prime = num;
}
num++;
}
printf("
");
return 0;
}
 write a c code using onlinegdb.com, and the following code that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!