This is the program to show the function of modulus "%".In C and C++ language programming this function is used for finding the reminder for example if 9 is divided by 2 then the reminder will be 1. let write a program to understand it.
C Program:-
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int num1=9;
int num2=2;
printf("The reminder is = %d",num1%num2); //this is the direct method which I apply.
getch();
}
Output:-
The reminder is = 1
C Program:-
#include<stdio.h>
#include<conio.h>
void main(void)
{
clrscr();
int num1=9;
int num2=2;
printf("The reminder is = %d",num1%num2); //this is the direct method which I apply.
getch();
}
Output:-
The reminder is = 1
No comments:
Post a Comment