ssc2 Computer Science
ssc2 Computer Science
SECTION – C
Q3.
5X4=20
Draw a flowchart to calculate the exponent of a given number.
OR
Rewrite the following code after removing the errors: (5)
# include < std.h>
# include < conio.h>
void main ( );
{ int p, s;
printf(“\n Enter a number:);
scanf(“%d”, p);
s=p%2;
if(s=0)
printf(“even number%d”, p)
else
printf(“odd number%d”, p); getch( );
}
Q 4.
Rewrite the following program using switch statement: (5)
void main()
{char Ch;
clrscr( );
printf(“Enter a single character”);
scanf(“%c”, ch);
if ( ch = = ‘a’ || ch = = ‘A’ ||ch = = ‘e’ || ch = = ‘E’ ||ch = = ‘i’ || ch = = ‘I’ || ch = = ‘o’ || ch = = ‘O’ ||ch = = ‘u’ ||
ch = = ‘U’)
printf(“It is a vowel”);
else
printf(“It is a consonant”);
}
OR
Explain FIVE modules of C programming environment.?
Q 5.
What will be the output of the following code?
void main( )
{ int u, i;
for (u = 1; u< = 5; u++)
{
for (i = 1; i < = u; i++)
{
printf(“%d \t”, i);
}
printf(“\n”);
}
}
OR
Convert the following code into for loop:
int sum = 0, num= 0;
do { sum = sum + num;
printf (“Enter an integer value”);
scanf(“%d”, &num);
} while (num > = 0 && num < = 15);
Q 6.
Flowchart to print the given sequence of numbers in descending order 27 24 21 18 15 12 9 6 3 0 -3 -
6?
OR
What is control structure? Explain conditional control structure with examples.