Skip to main content

Practical-206 paper solution

Q-1 [A] Write a Python program to print Fibonacci series up to n terms. 


N=int(input('Enter a N : ')) 

A=0

B=1

for i in range(0, N) :

        Print(A, end=' ') 

        C=A+B

        A=B

        B=C


Q-1 [B] Write a program that creates structure of student with student id, name, percentage. Enter data of five students. Display data of those student whose percentage is less than 70 marks. 


#include <stdio.h>

#include <conio.h>


struct Student

{

    int id, percentage;

    char name[50];

};


void main()

{

    struct Student stu[5];

    clrscr();

    for (int i = 0; i < 5; i++)

    {

        printf("\nEnter data for student %d:\n", i + 1);

        printf("Enter student ID: ");

        scanf("%d", &stu[i].id);

        printf("Enter student name: ");

        scanf("%s", stu[i].name);

        printf("Enter student percentage: ");

        scanf("%d", &stu[i].percentage);

    }


    printf("\nStudents with percentage less than 70%:\n");

    printf("\nId\tName\tPercentage\n\n");

    for (int i = 0; i < 5; i++)

    {

        if (stu[i].percentage < 70)

        {

            printf("%d\t%s\t%d\n", stu[i].id, stu[i].name, stu[i].percentage);

        }

    }

    getch();

}


Q-2 [A] Create following tables and apply appropriate constraints Insert at least 10 records in each table.

Distributor(dno, name, phoneno)

Item(ino, Name, color) 

Dist_item(dno, ino, qty)


Create table Distributor

(dno number primary key, 

name varchar(20), 

Phoneno number) ;


Create table Item

(ino number primary key, 

name varchar(20), 

color varchar(20)) ;


Create table Dist_item

(dno number, 

Constraint a foreign key(dno) references Distributor(dno), 

ino number, 

Constraint b foreign key(ino) references Item(ino), 

Qty number) ;


Q-2 [B] Write a PL/SQL block to takes input of the department no and display the information of particular distributor. 


DECLARE

        v_dno number:=&dno;

        v_name varchar(20) ;

        v_phoneno number;

BEGIN

        SELECT name, phoneno INTO v_name, v_phoneno FROM Distributor WHERE dno = v_dno;

        DBMS_OUTPUT.PUT_LINE('Distributor Id: ' || v_dno);

        DBMS_OUTPUT.PUT_LINE('Distributor Name: ' || v_name);

        DBMS_OUTPUT.PUT_LINE('Phone Number: ' || v_phoneno);


END;

/


Comments

Popular posts from this blog

Remove specific item from Recyclerview in android studio

For Full video click on below link :- https://youtu.be/sUz4fqeanjI?si=A8AqBWCgu-5NnBOJ Working with the activity_main.xml file. Navigate to the   app > res > layout > activity_main.xml  and add the below code to that file. Below is the code for the   activity_main.xml   file.  <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical" android:background="@color/white"> <EditText android:layout_width="350dp" android:layout_height="50dp" android:inputType="text" android:id="@+id/coursenam...

Fingerprint Authentication in Android Studio Project

Implement the implementation : - implementation 'androidx.biometric:biometric:1.0.1' Working with the activity_main.xml file. Navigate to the   app > res > layout > activity_main.xml  and add the below code to that file. Below is the code for the   activity_main.xml   file. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" tools:context=".MainActivity" android:background="@color/white"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Welcome to the Boxcode!!" android:textSize=...

programming skills imp programs

Full course of c++ programming language Click here >  C++ programming language ===================================== 1. Write a program to display an average of 3 inputted numbers. a=int(input("Enter a : ")) b=int(input("Enter a : ")) c=int(input("Enter a : ")) avg=(a+b+c)/3 print(avg) ====================================== 2. Write a program to calculate simple interest for a given principle amount, rate of interest and no of years. p=float(input("Enter a P : ")) r=float(input("Enter a R : ")) n=float(input("Enter a N : ")) si=(p*r*n)/100 print("simple interest is ",si) ====================================== 3. Write a program to display area of triangle. base=float(input("Enter a base : ")) height=float(input("Enter a height : ")) area=base*height/2 print("Area of triangle is ",area) ====================================== 4. Write a program to calculate area of circle. r=float(input...