Professional Documents
Culture Documents
Data type
Problem 1: Area of Circle;
#include<stdio.h>
int main()
{
double r, A;
scanf("%lf",&r);
A= 3.141592653*r*r;
printf("%.9lf\n",A);
return 0;
}
OUTPUT
return 0;
}
OUTPUT
return 0;
}
OUTPUT
LOOP
Problem 4: A-1 to N;
#include<stdio.h>
int main(){
int i,N;
scanf("%d",&N);
for(i=1; i<=N; i++){
printf("%d\n",i);
}
return 0;
#include<stdio.h>
int main(){
int i, n;
scanf("%d",&n);
if(n<2)
printf("-1\n");
for(i=2; i<=n; i+=2){
printf("%d\n",i);
}
return 0;
}
OUTPUT
Problem 6: Even, odd, positive, negative;
#include<stdio.h>
int main(){
int i, n, x, even=0, odd=0, positive=0, negative=0;
scanf("%d",&n);
for(i=0; i<n; i++)
{
scanf("%d",&x);
if(x%2==0)
even++;
if(x%2!=0)
odd++;
if(x>0)
positive++;
if(x<0)
negative++;
}
printf("Even: %d\n", even);
printf("Odd: %d\n", odd);
printf("Positive: %d\n", positive);
printf("Negative: %d\n", negative);
return 0;
}
OUTPUT
int x,i;
scanf("%d",&x);
for(i=1; i<=12; i++)
{
printf("%d * %d = %d\n",x,i,i*x);
}
return 0;
}
OUTPUT
Problem 10: Factorial
#include <stdio.h>
int main() {
int n, x, i, j;
long long mul = 1;
scanf("%d", &n);
printf("%lld\n", mul);
mul = 1;
}
return 0;
}
OUTPUT
int main() {
int x, i, k = 0;
scanf("%d", &x);
if (k == 1)
printf("NO");
else
printf("YES");
return 0;
}
OUTPUT
#include<stdio.h>
int main()
{
int x, i, j;
scanf("%d",&x);
for(i=1; i<=x; i++)
{
if(x%i==0)
{
printf("%d\n",i);
}
}
return 0;
}
OUTPUT
}
OUTPUT
return 0;
}
OUTPUT