0% found this document useful (0 votes)
15 views2 pages

Experiment3 Programs

Uploaded by

anuj2006arote
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views2 pages

Experiment3 Programs

Uploaded by

anuj2006arote
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include <stdio.

h>
void main()
{
int day;
printf("\nEnter a number");
scanf("%d",&day);
printf("\nThe day with number %d is ", day);
switch (day)
{
case 1:
printf("Monday");
break;
case 2:
printf("Tuesday");
break;
case 3:
printf("Wednesday");
break;
case 4:
printf("Thursday");
break;
case 5:
printf("Friday");
break;
case 6:
printf("Saturday");
break;
case 7:
printf("Sunday");
break;
default:
printf("Invalid Input");
break;
}
getch();
}
=======================================================================
#include <stdio.h>

int main() {

int n, i, flag = 0;
printf("Enter a positive integer: ");
scanf("%d", &n);

// 0 and 1 are not prime numbers


// change flag to 1 for non-prime number
if (n == 0 || n == 1)
flag = 1;

for (i = 2; i <= n / 2; ++i) {

// if n is divisible by i, then n is not prime


// change flag to 1 for non-prime number
if (n % i == 0) {
flag = 1;
break;
}
}
// flag is 0 for prime numbers
if (flag == 0)
printf("%d is a prime number.", n);
else
printf("%d is not a prime number.", n);

return 0;
}
===============================================================================
#include <stdio.h>

void main() {
int i;

for (i = 0; i < 10; i++) {


if (i == 4) {
continue;
}
printf("%d\n", i);
}

getch();
}

===============================================================================
#include<stdio.h>

void main()
{
int age;

g: //label name
printf("you are Eligible\n");
s: //label name
printf("you are not Eligible");

printf("Enter you age:");


scanf("%d", &age);
if(age>=18)
goto g; //goto label g
else
goto s; //goto label s
}

You might also like