CPROGRAM1
CPROGRAM1
#include<stdio.h> #include<stdio.h>
int sum(); int main(){
void main() int i=1;
{ while(i<=10){
int result; printf("%d \n",i);
printf("\nGoing to calculate the sum of two i++;
numbers:"); }
result = sum(); return 0;
printf("%d",result); }
}
int sum()
{ Output
int a,b; 1
printf("\nEnter two numbers"); 2
scanf("%d %d",&a,&b); 3
return a+b; 4
} 5
6
Output 7
Going to calculate the sum of two numbers: 8
Enter two numbers 10 9
24 10
The sum is 34
return 0;
}