Sum of N numbers which are divisible by 5 #include<stdio.h> |
|
int main() { | |
int a,sum=0,i=1; | |
scanf("%d",&a); | |
while(i<=a) | |
{ | |
if(i%5==0) | |
{ | |
sum=sum+i; | |
} | |
i++; | |
} | |
printf("%d",sum); | |
return 0; | |
} Output:
Enter Number:100
1050
|
Crack technical interview... Zero to Hero in C program logical programs. Any Doubts Contact 07904216292
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment