Posts

DSA Practical Exam pdf - 17 jan 2024

DSA PRACTICAL PDF :  Practical 1 Aim: Write a C++ program to          1.1) Traverse the elements in array Program: - #include<iostream> using namespace std; int main(){ int arr[100],n,a; cout <<"Enter the size of array: "; cin>>n; cout <<"Enter the element of array: "; for(int i =0; i<n; i++){ cin >> a; arr[i] = a; } cout <<"the element of array : "<< endl; for(int j = 0; j< n; j++){ cout << arr[j]<< endl; } return 0; } Output:     1.2) insert the elements in array Program: #include<iostream> using namespace std; int main() { int arr[100], n, a, item, pos; cout << "Enter the size of array: "; cin >> n; cout << "Enter the elements of array: "; for(int i = 0; i < n; i++) { cin >> a; arr[i] = a; } cout << "The elements of array: " << endl; for(int j = 0; j < n; j++) { cout << arr[j] << endl; } cout << ...

JAVA practical exam pdf - 16 January

Image
practical pdf: Program 1 :  WAP for Fibonacci series. import java.util.*; class Fibonacci{ public static void main(String args[]) { Scanner scanner = new Scanner(System.in); System.out.print("Enter the number of terms for Fibonacci series: "); int count = scanner.nextInt(); int n1=0,n2=1,n3,i; System.out.print(n1+" "+n2); for(i=2;i<count;++i) { n3=n1+n2; System.out.print(" "+n3); n1=n2; n2=n3; } } } OUTPUT:  Microsoft Windows [Version 10.0.22000.2538] (c) Microsoft Corporation. All rights reserved. C:\Users\admin>cd/ C:\>cd chaitanya C:\chaitanya>javac Fibonacci.java C:\chaitanya>java Fibonacci Enter the number of terms for Fibonacci series: 20 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 C:\chaitanya> Program 2 : WAP with class that has static method that include a logic of even and odd number. import java.util.Scanner; public class Prog2 {          public static void EvenOrOdd(int number) {  ...