Assignment 2, Roll No. 91
Assignment 2, Roll No. 91
#include <stdio.h>
int main()
{
printf("Enter your age:-");
int a;
scanf("%d",&a);
if ((a>=18)&&(a<=25)){
printf("You are eligible for our institute
scholarship program");
}
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter the user choice(1,2,3):-");
int g;
scanf("%d", &g);
printf("Enter the two number:-");
float t, m;
scanf("%f%f", &t, &m);
if (g == 1)
{
printf("The addition of two number %f and %f is
%f", t, m, t + m);
}
else if (g == 3)
{
printf("The mulitplication of the two number %f and
%f is %f", t, m, t
* m);
}
else if (g == 2)
{
printf("The subtraction the two number %f and %f is
%f", t, m, t -m);
}
else
{
printf("Invalid option");
}
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter the username:- ");
int u;
scanf("%d",&g);
printf("\nEnter the password:- ");
int h;
scanf("%d",&h);
if (g==h){
printf("Matched access granted");
}
else{
printf("Wrong password ");
}
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter the score in the test:- ");
float g;
scanf("%f",&g);
if (g>90){
printf("Congrats for this score");
}
else if (g<60){
printf("You need work even more harder");
}
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter the radius of the circle :- ");
float g;
scanf("%f", &g);
if (g > 0)
{
printf("Area of the circle having radius %f is %f",
g, 3.14 * g * g);
}
else
{
printf("Oops its a negative value");
}
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter your credit score :- ");
float g;
scanf("%f", &g);
if (g > 700)
{
printf("Hurry your loan application is approved");
}
else if ((g>600)&&(g<700))
{
printf("We need more information");
}
else if (g<600){
printf("Sorry your loan application is rejected");
}
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter your age:- ");
int g;
scanf("%d", &g);
if (g <13)
{
printf("You need permission from your parent before
proceeding");
}
else if (g>13)
{
printf("Accesss granted");
}
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter number of item you purchase:- ");
int g;
scanf("%d", &g);
int price = g * 100;
int t = (price * 0.1);
if (price > 1000)
{
printf("Congratulations you get discount \n your
final price is %d ",
(price - t));
}
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter your salary:- ");
int g;
scanf("%d", &g);
printf("Enter the year of service:- ");
int f;
scanf("%d",&f);
float bonus = g * 0.05;
if (f>5)
{
printf("Your net bonus is %f", bonus);
}
return 0;
}
#include <stdio.h>
int main()
{
printf("Enter the age of the three people :- ");
int g,h,j;
scanf("%d%d%d", &g,&h,&j);
if ((g>h)&&(g>j))
{
printf("The age of the first is max");
}
else if ((h>g)&&(h>j))
{
printf("The age of the second is max");
}
else if ((j>g)&&(j>g))
{
printf("The age of the third is max");
}
return 0;
}
12.
If
x = 2;
y = 5;
z = 0;
then find values of the following expressions:
a)true
b)true
c)true
d)True
e)Flase