For the experiment Taru has N buckets (numbered from 1,2,3..N) which all are initially empty. She has M number of queries. Each query represents an integer that is of 4 types. Query 1: Fill all the buckets with water •Query 2: Empre even valued buckets (2, 4, 6 N) Query 3: Empty all odd number buckets (1, 3, 5, N). •Query 4: Empty all the buckets (1,2,3. N). You have to return the number of buckets that are filled after performing M queries,using fillbucket function
How to execute this using vector
#include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
int fibo(int n);
int main() {
string header = " Index Fibonacci number Fibonacci quotient Deviation";
double lim = (1.0 + sqrt(5.0)) / 2.0;
int fib_sequence[21];
for (short i = 0; i < 21; i++) {
fib_sequence[i] = fibo(i);
}
cout << header << endl;
for (short i = 0; i < 20; i++) {
double q = (double)fib_sequence[i + 1] / (double)fib_sequence[i];
cout << setw(5) << i << setw(15) << fib_sequence[i] << setw(20) << fixed
<< setprecision(10) << q << setw(20) << scientific << setprecision(3)
<< lim - q << endl;
}
return 0;
}
int fibo(int n) {
if (n <= 1)
return n;
return fibo(n - 1) + fibo(n - 2);
}
Write a C program using two dimensional arrays that determine the even numbers among the twelve input values from the keyboard and prints the list of these even numbers
Explain various types of logical operators used in C language with examples.
Write a program in C that display even numbers between 50 and 250 using do while loop.
Discuss switch case statement in C language programming language by taking a suitable example
Write a program in C language that calculates the roots of quadratic equation ax 2 +bx+c.
Write a program in C language that print the sum of first and last digit of 7 digit
input number N (5)
[For example if N=98765 the output is 9(First Digit) + 5(Last Digit)=14
Write a program in C programming language that print the following sum of series 1+4+7+10………+N
write a program to check whether a number is divisible by 5 and 11 or not.using the switch statement