I know the program below is almost wrong and I am seeking for a hep to fix that UP
please help:
#include
#include
int i;
float r;
char c;
char s[48];
int main() {
i=4;
r=3;
c='z';
strcpy(s,"Hi There");
printf("i=%d,r=%d,c=%d")
}
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Aug 1, 2012, 4:58 AM
sam aldosPosted Aug 1, 2012, 7:29 PM
Write a program to compute and print the day of Easter Sunday in 2011 (24th Apr). The output should be in the form:
Month m, day n.
Where m is the month number (3 for March, 4 for April), and n is the day in the month.
The date for Easter Sunday is March(22 + a + b), where
a = (19c + 24) remainder 30
b = (2d + 4e + 6a + 5) remainder 7
c = year remainder 19
d = year remainder 4
e = year remainder 7
If (22 + a + b) is greater than 31, the date is in April.
You will need to do a division and remainder to correct for this.
Make sure that your program also works for other years - 1991 (31st March), 1997 (30th March) and 2018 (1st April)!
sam aldosPosted Aug 1, 2012, 7:29 PM
8. Write a program that declares a character string buffer, large enough to hold 63 characters. Using the strcpy function, assign the text string "Question 8" to buffer. Use a printf statement to print the string. Use another printf statement and the strlen function to print how many characters are in the string.
Question 8
buffer contains 10 characters
sam aldosPosted Aug 1, 2012, 7:28 PM
Money amounts are normally stored in integer variables as cents - to keep the figures accurate. Write a program which stores such a value in a variable (e.g. cents = 2453; for $24.53). Then print the value in dollar and cent format by computing the dollar and cent components (using the / and % operators) and printing them with a dollar sign before and a point in between.
sam aldosPosted Aug 1, 2012, 7:28 PM
sam aldosPosted Aug 1, 2012, 7:28 PM
Can your system store values larger than 2147483647in an int? Write a program to find out, initialise a variable with the value 2147483646, then print it, add one to the variable and print it again, repeat this a few times.
sam aldosPosted Aug 1, 2012, 7:27 PM
Write a program that prints the following message exactly as shown:
When using printf:
Use "%s" for strings
and "%d" for integers
and "%c" for characters.
sam aldosPosted Aug 1, 2012, 7:27 PM
1. Explain what happens in the following program:
#include
int i;
int main() {
i = 100 / 7;
i = i * 7;
printf("i=%d\n",i);
}
2. Rewrite the following using combined arithmetic/assignment operators such as +=
a = b + a;
b = b - c;
ww = ww / 5.8;
3. Rewrite the following without using combined arithmetic/assignment operators
a += 23;
sbc -= (ar /= 2;
VulpesPosted Aug 1, 2012, 8:31 AM
sam aldosPosted Aug 1, 2012, 5:21 AM
Regards,
See the attached file sir.
sam aldosPosted Aug 1, 2012, 4:48 AM
is it about storing,, I am very very week in programming and I wanna pass my paper.
Kindest Regards,
VulpesPosted Aug 1, 2012, 4:32 AM
printf("i=%d,r=%f,c=%c", i, r, c);