Read OnLine C- Program Example
06_FUNCTION CONCEPT | |
---|---|
PRAC 1 | PRAC 2 |
//wap to print addtion in function #include<stdio.h> #include<conio.h> void add() { int a,b,ans; clrscr(); printf("Enter 1st number:"); scanf("%d",&a); printf("Enter 2nd number:"); scanf("%d",&b); ans=a+b; printf("Addition:%d",ans); } void main() { add(); getch(); |
//wap to print addtion in function #include<stdio.h> #include<conio.h> void add(int x,int y) { int ans; ans=x+y; printf("Addtion=%d",ans); } void main() { int a,b; clrscr(); printf("Enter 1st number:"); scanf("%d",&a); printf("Enter 2nd number:"); scanf("%d",&b); add(a,b); getch(); } -------output------- Enter 1st number:5 Enter 2nd number:5 Addtion=10 |
Previous | Next |
Download | Download |