You are on page 1of 3

1.

a)
• labels for program elements
• case sensitive
• can consists of capital letters[A..Z], small letters[a..z], digit[0..9], and
underscore character _
• First character MUST be a letter or an underscore
• No blanks
• Reserve words cannot be identifiers

b)

c)
i) printf(“The value is %d\n”, num);
-change the double quotation and commas

ii) if (c<7)
printf(“C is less than 7\n”);
-change the curl bracket with round bracket
2)
a)
i)

ii) #include <stdio.h>


int main() {
float g;
printf("Enter you grade:");
scanf("%f",&g);
if (g>=60) {
if (g<=100)
printf("Passed\n");
else
printf("Invalid number\n"); }
else
printf("Failed\n");
return 0; }
3)
a)

b) #include <stdio.h>
int main() {
int i;
for (i=2;i<=1024;i=i*2) {
if (i==1024)
printf("%d",i);
else
printf("%d, ",i); }
return 0; }

You might also like