Lab Report Experiment 2
Lab Report Experiment 2
Source Code
#include <stdio.h>
#include <stdlib.h>
int main() {
int answer=977;
int password;
scanf("%d", &password);
if(password == answer){
}else{
printf("FAILED ATTEMPT\n");
return 0;
Output
a)
b)
c)
PART A-2
Source Code
#include <stdio.h>
#include <stdlib.h>
int main() {
int first,second,ans;
char *polarity;
scanf("%d",&first);
scanf("%d",&second);
return 0;
Output
a)
b)
c)
PART A-3
Source Code
#include <stdio.h>
#include <stdlib.h>
int main() {
int x,y;
char *comparison;
scanf("%d",&x);
scanf("%d",&y);
return 0;
Output
a)
b)
c)
PART A-4
Source Code
#include <stdio.h>
#include <stdlib.h>
int main() {
char alph;
printf(“enter an alpha character: “);
scanf(“%c”,&alph);
switch(alph) {
case ‘a’:
break;
case ‘b’:
break;
case ‘c’:
break;
default:
break;
printf(“Thank you.\n”);
return 0;
Output
PART B-1
Source Code
#include <stdio.h>
#include <stdlib.h>
int main()
int first,second;
char*comparison;
scanf("%d",&first);
scanf("%d",&second);
if (first>second){comparison="Greater Than";}
else if (first==second){comparison="Equal";}
return 0;
Output
PART B-2
Source Code
#include <stdio.h>
#include <stdlib.h>
int main() {
char alph;
scanf("%c",&alph);
switch(alph) {
case 'a':
break;
case 'b':
break;
case 'c':
break;
default:
break;
printf("Thank you.\n");
return 0;
Output