Aptitude Lab Practical File
Aptitude Lab Practical File
Aptitude Lab Practical File
#include<stdio.h>
// sum of 2 number
int main() {
int a, b;
printf("enter a \n");
scanf("%d", &a);
printf("enter b \n");
scanf("%d", &b);
printf("sum of a & b is : %d \n", a+b);
return 0;
}
output-
a=5
b=4
Value is = 9
Q.2- Find the output of c programming using with operators?
#include<stdio.h>
Int main()
{
//working of arithmetic operators.
int a=9, b=4, c;
c=a+b;
printf(“a+b = %d \n”, c);
c=a-b;
printf(“a-b = %d \n”, c);
c=a*b;
printf(“a*b = %d \n”, c);
c=a/b;
printf(“a*b = %d \n”, c);
c=a%b
printf(“a%b = %d \n”, c);
return 0;
}
output
a+b=13 ,
a-b=5
a*b= 36
a/b=2
(Reminder when a divided by b=1)
Q.3- Arrange the operators according to their
precedence: +, %, ->, =.
#include <stdio.h>
int main() {
// according to precedence rule
int a=20;
int b=10;
int c=15;
int d=5;
int e;
e=(a+b)*c/d;
printf("value of (a+b)*c/d is : %d \n",e);
return 0;
}
Output
Value of (a+b)*c/d is : 90
Q.4- Predict the output of following program using with
bitwise?
#include <stdio.h>
int main()
{
int a=12, b=25;
printf("outpur=%d",a&b);
return 0;
}
Operator Meaning of operator
&& Bitwise AND
|| Bitwise OR
! Bitwise NOT
Q.5- Find the output of c programming using with basic
input, output?
Scanf()- The scanf() method in c reads the value from the
console as per the type specified.
Printf()- The printf(() method in c print the value passed as
The parameter to it on the console screen.
# include<stdio.h>
// area of squre
Int main () {
printf(“enter radius”);
scanf(“%f”, & radius);
printf(“area is : %f”, 3.14*radius*radius);
Output
Enter radius : 3
Area is : 28.26
Q.6 Find the output of c programming using with declaration
Data types.
Ans- Data type is a type of data which is used in the program.
In other word use can say that it is used to declare a
Variable.
DATA TYPE
Size Range
Int(2 byte) (-32768 to 32767) Array