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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Aug 1, 2012, 12:58 AM EDT
VulpesRank #55 · 29.2K reputationPosted Aug 1, 2012, 12:32 AM EDT
printf("i=%d,r=%f,c=%c", i, r, c);
sam aldos21 reputationPosted Aug 1, 2012, 12:48 AM EDT
is it about storing,, I am very very week in programming and I wanna pass my paper.
Kindest Regards,
sam aldos21 reputationPosted Aug 1, 2012, 1:21 AM EDT
Regards,
See the attached file sir.
VulpesRank #55 · 29.2K reputationPosted Aug 1, 2012, 4:31 AM EDT
sam aldos21 reputationPosted Aug 1, 2012, 3:27 PM EDT
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;
sam aldos21 reputationPosted Aug 1, 2012, 3:27 PM EDT
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 aldos21 reputationPosted Aug 1, 2012, 3:28 PM EDT
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 aldos21 reputationPosted Aug 1, 2012, 3:28 PM EDT
sam aldos21 reputationPosted Aug 1, 2012, 3:28 PM EDT
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 aldos21 reputationPosted Aug 1, 2012, 3:29 PM EDT
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 aldos21 reputationPosted Aug 1, 2012, 3:29 PM EDT
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)!