Practice makes us perfect | Problem - 2 | Beginner level | C language | CodeChef
Link to the problem statement: https://www.codechef.com/submit-v2/PRACTICEPERF
Solution:
Method 1
#include <stdio.h>
int main(void) {
int a[4], i, j;
scanf("%d %d %d %d", &a[0], &a[1], &a[2], &a[3]);
for(i=0; i<4 ; i++)
{
if(a[i]>=1 && a[i]<=100)
{
if(a[i]>9)
{
j++;
}
else
continue;
}
else
continue;
}
printf("%d", j);
return 0;
}
Method 2
#include <stdio.h>
int main(void) {
int a[4], i, j;
for(i=0; i<4 ; i++)
{
scanf("%d", &a[i]);
}
for(i=0; i<4 ; i++)
{
if(a[i]>=1 && a[i]<=100)
{
if(a[i]>9)
{
j++;
}
else
continue;
}
else
continue;
}
printf("%d", j);
return 0;
}
You can watch the video solution of this problem:
Hope this will help you, if you want anything else leave a comment.
Thank you
Comments
Post a Comment