Sample Programs
Sample Programs
h>
int main(){
int number;
printf("enter a number:");
scanf("%d",&number);
return 0;
#include<stdio.h>
int main(){
int x=0,y=0,result=0;
scanf("%d",&x);
scanf("%d",&y);
result=x+y;
return 0;
}
Example of variable initialization:
1. #include <stdio.h>
2. int main() {
7. // Later in the program, you can change the value of the variable
8. age = 30;
9. salary = 3000.0;
10.
11. return 0;
12. }
int main() {
scanf(“%f”, &fahrenheit);
return 0;
int main() {
return 0;