Department of Computer Engineering
Computer Programming 66111
HW2
Dead Line Q1, Q2
20/11/2012 Thursday
Q1: Write a complete C/C++ program to do the following:
1-Define static array called A of size 8 of type double, read all elements from keyboard then compute and print the product of all elements that found in odd indices
[1,3,5….]
2-Define two dynamic arrays called B and C of size 5 of type character, read all elements from keyboard then compute:
The count of occurrence of vowels (‘a’,’u‘,’i’,’e’) in both array B and C.
Replace all capital letters of array C with ‘#’
Fill a new dynamically allocated array called D from only the small letters in both arrays B and C .
Q2: Write a function that takes an integer m as a parameter then return the following sum. Y m
4
Sum= (2 *Y 100 )
Y 1
Good Luck
You May Also Find These Documents Helpful
-
Step 7 : Repeat this step using remainder REM of this step as input string,…
- 288 Words
- 2 Pages
Satisfactory Essays -
3. Write assignment statements that perform the following operations with the variables a, b, and c.…
- 1062 Words
- 8 Pages
Satisfactory Essays -
4.) Write assignment statements that perform the following operations with the variables a, b, and c:…
- 453 Words
- 3 Pages
Satisfactory Essays -
1) Numbers can be represented in binary (using 2 symbols 0 and 1) and hexadecimal ( 16 symbols…
- 480 Words
- 2 Pages
Satisfactory Essays -
Arrays store items that have the same type of data type like a group of employees’ names and social security numbers for a team of 2000 personal. Pointer is a variable that greatly extends the power and flexibility of a program, each memory location that is used to store data value has an address. The address provides the means for a PC hardware to reference a particular data item.…
- 485 Words
- 2 Pages
Good Essays -
should you do if you do not want to wait for a command to finish before…
- 1263 Words
- 5 Pages
Powerful Essays -
Once again Berry’s Bug Blasters are requesting an update to the previous program that was designed to help them to better serve their customers. The company has requested a way to display the name and phone number of their clients so that they can keep a record of what clients have called. The best way in the opinion to accomplish this is to build an array into the program. This will allow those in charge of the company record to record who has called and then to display the names of the clients and their number in a chart so that it can be recalled at a later date as needed.…
- 833 Words
- 4 Pages
Good Essays -
Programs need to store data at some time during the execution of processes. Data is held in variables which are names containers for each piece of data. Each variable must be given a name so it can be referred to again and again throughout the program. It should be something that is recognisable because for example variable 1 would be soon forgotten in a substantial piece of code. Variable names cannot be the same as code words such as print or run.…
- 529 Words
- 3 Pages
Good Essays -
3. Write assignment statements that perform the following operations with the variables a, b, and c.…
- 313 Words
- 2 Pages
Satisfactory Essays -
4.) Write assignment statements that perform the following operations with the variables a, b, and c:…
- 470 Words
- 3 Pages
Satisfactory Essays -
3. Write assignment statements that perform the following operations with the variables a, b, and c.…
- 748 Words
- 3 Pages
Powerful Essays -
A ____ read is an added statement that gets the first input value in a program.…
- 993 Words
- 6 Pages
Satisfactory Essays -
* Your program might be asking the user for input, or gathering input from a web site. As it finds objects (strings, books, values, etc.) you will add them to the array…
- 1445 Words
- 6 Pages
Powerful Essays -
Write a program to input a start limit S (S>0) and the last limit L (L>0). Print all the prime triplets between S and L (both inclusive), if S<=L otherwise your program should ask to re-enter the values of S and L again with a suitable error message.…
- 666 Words
- 3 Pages
Good Essays -
/Contiguous file allocation/ #include<stdio.h> Int main() { char a[10][10]; int I,flb[10],sb[10]; for(i=1;i<=5;i++) { printf(“\nEnter the file name:”); scanf(“%s”,&a); printf(“\nEnter the starting block:”); scanf(“%d”,&sb[i]); printf(“\nEnter the file length in blocks:”); scanf(“%d”,&flb[i]); } printf(“\n\nList of files\tstarting block\tfile length”); for(i=0;i<5;i++) { printf(“\n%s\t%d\t%d”,a[i],sb[i],flb[i]); } return 1; } /indexed allocation/ #include<stdio.h> int main() { char a[10]; int i,1.b,a.b[10]; srintf(“\nEnter the file name:”); Scanf(“%d”,&a); printf(“\n\nIndexed block:”); scanf(“%”,&ib); for(i=1;i<5;i++){ printf(“\nEnter the child of index block%d:”,i); scanf(“%d”,&c I b[i]); } printf(“\n\n\nThe list of files\t index block”); printf(“\n\n%s\t%d”,a,ib); printf(“\n\nThe above file utilization index block of child following!\n\n\t”); for(i=1;i<=5;i++){ printf(“%d\t”,c I b[i]); } return 1; } /linked allocation/ #include<stdio.h>…
- 317 Words
- 2 Pages
Good Essays