C Program to check if the number is a multiple of 5 or not

Solution with out using functions
Solution using functions without passing arguments
Solution using functions and by passing arguments



Solution : Without using function
Program/Source Code

#include <stdio.h>

 int main()
 {
    int n;
     printf("Enter any no ");
     scanf("%d",&n);
     if(n%5==0)
         printf("Number is multiple of 5");
     else
         printf("Number is not multiple of 5");
 return 0;
 }

Output:

case :1
Enter any no 85
Number is multiple of 5

case :2
Enter any no 36
Number is not multiple of 5



Solution : Using function Without Passing Arguments
Program/Source Code

#include <stdio.h>
void check()
{
    int n;
     printf("Enter any no ");
     scanf("%d",&n);
     if(n%5==0)
         printf("Number is multiple of 5");
     else
         printf("Number is not multiple of 5");
}
 int main()
 {
     check();
 return 0;
 }

Output:

case :1
Enter any no 45
Number is multiple of 5

case :2
Enter any no 66
Number is not multiple of 5



Solution : Using function Passing Arguments
Program/Source Code

#include <stdio.h>
void check(int n)
{
     if(n%5==0)
         printf("Number is multiple of 5");
     else
         printf("Number is not multiple of 5");
}
 int main()
 {
      int n;
     printf("Enter any no ");
     scanf("%d",&n);
     check(n);

 return 0;
 }

Output:

case :1
Enter any no 25
Number is multiple of 5

case :2
Enter any no 26
Number is not multiple of 5

Previous:

Next:

C Basic programs     if Condition Programs     Loop Programs    Pattern Programs     Very Important Programs    Single Dimension Numeric Array    Double Dimension Numeric Array     Character Array

C Language Programming Tutorial

C Language Tutorial Home    Introduction to C Language     Tokens     If Condition     goto statement and Labelname     Switch Statements     For loop     While Loop    Do while loop     break and continue    Functions    Recursion    Inbuild Functions    Storage Classes    Preprocessor    Arrays    Pointers     Structures and Unions    File Handling     Projects

Tutorials

Technical Questions

Interview Questions

C Programming
C++ Programming
Class 11 (Python)
Class 12 (Python)
C Language
C++ Programming
Python

C Interview Questions
C++ Interview Questions
C Programs
C++ Programs