TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Function with no Arguments and no Return Value In C
Ashish Srivastava
Apr 21
2016
Code
8.9
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
#include <stdio.h>
#include <conio.h>
void
prime();
void
main(){
prime();
//No argument is passed to prime().
getch();
}
void
prime(){
/* There is no return value to calling function main(). Hence, return type of prime() is void */
int
num,i,flag=0;
printf(
"Enter positive integer enter to check:\n"
);
scanf(
"%d"
,&num);
for
(i=2;i<=num/2;++i){
if
(num%i==0){
flag=1;
}
}
if
(flag==1)
printf(
"%d is not prime"
,num);
else
printf(
"%d is prime"
,num);
}
C
Function with no arguments
no return value