what is test cases?can u give an example program with question and solution how to give inputs outputs
Question:
Suppose you want to test whether a number is odd or even.
Where T is the test cases. and first line of each test case contains a integer which will be tested.
And finally print whether each input is even or odd ?
Test Case :
So basically test cases means the number of times you will take input to execute your code and to produce the desired output.
Test Case=5;
Code:
#include<stdio.h>
main()
{
int T=5,i,input;
for(T=0;T<5;T++)
{
printf("\nGive a input:");
scanf("%d",&input);
if(input%2==0)
printf("\n%d is Even",input);
else
printf("\n%d is Odd",input);
} //Loop End for test cases
}
So Here your code will run five times to take five inputs to check whether that is odd or even.
That’s all.
Let me inform if you have any other doubts.