Artificial Intelligence Lab File

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

MANAV RACHNA UNIVERSITY, FARIDABAD

Department of Computer Science


Course: B. Tech (CSE) Semester: IVth Session: 2024

Practical File
4th Semester (Academic Year: 2024)
Subject Name: - Artificial Intelligence
Subject Code: - CSH205B-T

Submitted to: - Mr. Agha Imran Husain

Submitted by: - Nishchay Gupta


Roll No: - 2K22CSUN01075
Branch: - Cse_4b
Department: - B. Tech
LAB-1
#include <stdio.h>

#include <string.h>

int main() {

char symptoms[100];

printf("Enter your symptoms (separated by a comma): ");

scanf("%[^\n]", symptoms);

if (strstr(symptoms, "fever") != NULL) {

if (strstr(symptoms, "cough") != NULL) {

if (strstr(symptoms, "shortness of breath") != NULL) {

printf("You may have COVID-19. Please consult a doctor.\n");

} else {

printf("You may have the flu. Please consult a doctor.\n");

} else {

printf("You may have a fever. Please consult a doctor.\n");

else if (strstr(symptoms, "cough") != NULL) {


if (strstr(symptoms, "sore throat") != NULL) {

printf("You may have a cold. Please consult a doctor.\n");

} else {

printf("You may have a cough. Please consult a doctor.\n");

else if(strstr(symptoms,"tiredness")!=NULL){

if(strstr(symptoms,"Increasing fever")){

printf("You may have Typhoid. Please consult a doctor.\n");

else{

printf("You may be having a fatigue. Please consult a doctor.\n");

else if(strstr(symptoms,"Chest pain")){

if(strstr(symptoms,"Nausea")){

printf("You may have pneumonia. Please consult a doctor.\n");

else{

printf("You may have viral fever. Please consult a doctor.\n");

}
}

else {

printf("Your symptoms do not match any known diseases. Please consult a doctor.\n");

return 0;

LAB-2

Q1.To find symptoms for the disease enter by the user.


1. Q2. Implement the following Family Tree in PROLOG. Create basic facts and rules and
check the same with appropriate goals.

Prithviraj Kapoor

(Ramsarni)

Raj Kapoor Shammi Kapoor Shashi Kapoor

(Krishna) GeetaBali Jennifer

Aditya Raj Kapoor Kunal Kapoor

Randhir Kapoor Ritu Kapoor Rishi Kapoor Reema Kapoor Rajeev Kapoor

(Babita) (Rajan Nanda) (Nitu)

Karishma Kareena Ranbir Kapoor

(Sanjay) (Saif)
Samaira
LAB-3

Q1.To find the entered element belong to the list or not.

Q2.To find the last member of the list


Q3.To find number of elements from the list
LAB (Strings)
1. Write a prolog program to convert the string of words into a list
of words.

2. Write a prolog program to convert the string into a list


of characters

3. Write a prolog program that read two strings and concatenate


them in one string as upper case
4. Write a prolog program that take a string of words and print
each word in line as upper case.

5. Write a prolog program that take a string and convert


each character it contains to its corresponding integer
value
LAB (Searching and Sorting)

Mergesort
LAB-11

Learning Outcomes: Representing and solving AI problems.

1.Write a program to solve Water Jug Problem in prolog.

2.Write a program to solve Tower of Hanoi in Prolog.

You might also like