Lab Report 1 PDF
Lab Report 1 PDF
Lab Report 1 PDF
Objective:
To swapping value of m and n.
To find a number is even or odd.
To find out which numbers are even or odd.
Description:
Program-1
Daclared three variables are named m, n & temp. Then take a value of m & n. Now m is assigned to temporary
Variable & n is assigned to m. Then temporary variable is assigned to n. After swapping finally we got the
result.
Program-2
Initialized a variable y. Then take a integer value of y. Now create a decision making using if-else statement. If
this integer value of y modulus 2 equal to 0 then the number are Even. Else this number modulus 2 is not
equal to 0 then the number are Odd.
Program-3
Declared three variables a[50], i & c. Then take a array size & array elements. Now use a for loop to execute a
sequence of statements multiple times. Then print Even number if array[i] modulus 2 eqaul to 0. Else array[i]
modulus 2 is not equal to 0 then it’s print Odd number.
Source Code: (Program-1)
/*Write a program to exchange the values of m and n*/
#include<stdio.h>
int main()
{
int m,n,temp;
printf("Enter the value of m: ");
scanf("%d",&m);
temp=m;
m=n;
n=temp;
printf("\nThe value of m: %d\n", m);
printf("\nThe value of n: %d\n", n);
return 0;
}
if (y%2==0)
printf("%d is even", y);
else
printf("%d is odd", y);
return 0;
}
int main()
{
int a[30],i,c;
return 0;
}
Input/Output:
Program-3
Discussion:
In first program we learn how to swapping value of two variables. This program swap the
value of x & y using swapping process.
In second program we learn how to find out even and odd number. This program help us to
find out any single even and odd number.
In third program we learn how to find out multiple even and odd number. Using this program
we can find out any multiple even-odd number & separates the even & odd number.