SEARCHING AN ARRAY
Write a program to search for an element ‘a’ in the array. Assume that the maximum size of the array is 15.
Input Format:
Input consists of n+2 integers. The first integer corresponds to ‘n’ , the size of the array. The next ‘n’ integers correspond to the elements in the array. The last integer corresponds to ‘a’, the element to be searched.
Output Format:
Refer sample output for details.
Sample Input 1:
5
2
3
6
8
1
6
Sample Output 1:
6 is present in the array
Sample Input 2:
5
2
3
6
8
1
9
Sample Output 2:
9 is not present in the array
#include
int main()
{
int i,n,a,A[30];
//printf("enter the value n");
scanf("%d",&n);
//printf("enter elements");
for(i=0;i
C Program To Calculate The Revenue The demand for organic food increases every year by 8.9%. Write a program to find the increase in revenue after 3 years. Given the revenue in the first year is ‘x’ crores. Input Format: The first line of the input is an integer that corresponds to the ‘x’ value. Output Format: Output is a float value that corresponds to the revenue after 3 years, rounded off to 2 decimal places. Sample Input: 4 Sample Output: 5.17 //PROGRAM #include<stdio.h> int main() { int x,i; float rev; scanf("%d",&x); rev=x; for(i=0;i<3;i++) { rev=rev*(1.089); } printf("%.2f",rev); return 0; }
Comments
Post a Comment