0

Multiple in c

write a function in c for multiple. #include <stdio.h> int main(void){ int a, b; printf("first number : \n"); scanf("%d", &a); printf("second number : \n"); scanf("%d", &b); if(b % a == 0){ printf("b is a multiple of a"); } return 0; }

26th May 2018, 8:06 PM
Jordan
Jordan  - avatar
3 Respostas
0
use functtion
26th May 2018, 8:22 PM
Jordan
Jordan  - avatar
0
#include <stdio.h> int multiple(int x,int y); int main(){ int a,b; printf("first number : \n"); scanf("%d", &a); printf("second number : \n"); scanf("%d", &b); printf("b is Multiple of a %d ",multiple(a,b)); } int multiple(int a,int b) { if(b % a == 0){ printf("b is a multiple of a"); return 1;} else{ return 0;} }
26th May 2018, 8:22 PM
Jordan
Jordan  - avatar