S1-Assignment-2 (Automata Fix) - Attempt Review
S1-Assignment-2 (Automata Fix) - Attempt Review
S1-Assignment-2 (Automata Fix) - Attempt Review
TT-101 /
Module - I /
S1-Assignment-2 (Automata Fix)
Correct
Write a C program to check whether the attendance is PRESENT using simple if statement?
For example:
Input Result
P
Present
Reset answer
int main()
char value;
scanf("%c",&value);
if(value=='P')
printf("Present");
return 0;
P Present Present
A
int main()
char value;
scanf("%c",&value);
if(value=='P')
printf("Present");
return 0;
Correct
Marks for this submission: 2.00/2.00.
Question 2
Correct
Write a C program to read a, b value and find the greatest value using if-else
For example:
Input Result
1 2
B is greatest.
5 4 A is greatest.
Reset answer
int a,b;
scanf("%d%d", &a,&b);
if(a>b)
printf("A is greatest.");
else
printf("B is greatest.");
return 0;
1 2 B is greatest. B is greatest.
5 4 A is greatest. A is greatest.
int main()
int a,b;
scanf("%d%d", &a,&b);
if(a>b)
printf("A is greatest.");
else
printf("B is greatest.");
Correct
Marks for this submission: 2.00/2.00.
Question 3
Correct
Write a C program to check whether the given number is even number and it is less than 10 or not using nested if.
For example:
Input Result
Reset answer
int main()
int num;
scanf("%d",&num);
if (num%2==0)
if (num<=10)
else
15 The number is NOT an even number The number is NOT an even number
if (num<=10)
else
else
return 0;
Correct
Marks for this submission: 2.00/2.00.
Question 4
Correct
Input Result
12 invalid number.
9
Nine.
Reset answer
int main()
int num;
scanf("%d",&num);
if (num==0)
printf("Zero\n");
else if(num==1)
printf("one\n");
else if(num==2)
printf("Two\n");
9 Nine. Nine.
int main()
int num;
scanf("%d",&num);
if (num==0)
printf("Zero\n");
else if(num==1)
printf("one\n");
else if(num==2)
printf("Two\n");
Correct
Marks for this submission: 2.00/2.00.
Question 5
Correct
Write a C Program to print digits into words using the switch statement(1- ONE, 5-FIVE)
For example:
Input Result
0 ZERO
4
FOUR
Reset answer
int main()
int choice;
scanf("%d",&choice);
switch (choice)
case 0: printf("ZERO");
break;
case 1: printf("ONE");
break;
case 2: printf("TWO");
break;
case 3: printf("THREE");
break;
case 4: printf("FOUR");
0 ZERO ZERO
4 FOUR FOUR
7 ... Plz Enter 0 to 5 Numbers Only... ... Plz Enter 0 to 5 Numbers Only...
int main()
int choice;
scanf("%d",&choice);
switch (choice)
case 0: printf("ZERO");
break;
case 1: printf("ONE");
break;
case 2: printf("TWO");
break;
case 3: printf("THREE");
break;
case 4: printf("FOUR");
Correct
Marks for this submission: 2.00/2.00.
Jump to...