Untitled Document
Untitled Document
Student Id : 0112510039
Section : B
#include<stdio.h>
int main()
{
printf("Hello World!");
return 0;
2. Write a C programming that will print the lines given in the sample output
#include<stdio.h>
int main()
{
printf("Hello World!\n");
printf("Welcome to C programming.\n");
printf("This is going to be fun!");
return 0;
}
3. Write a C program where you will declare an integer, a floating point and a
character variable, initialize them by values of your choice, and print these values.
#include<stdio.h>
int main()
{
int a;
float b;
char c;
printf("Integer value=%d\n",a);
printf("Floating point value=%.3lf\n",b);
printf("Character value=%c",c);
return 0;
4. Write a C program where you will declare two integer variables, initialize them by
values of your choice, and perform the basic arithmetic operations on them. The
basic arithmetic operations are addition (+), subtraction (-), multiplication (*),
division (/) and remainder (%).
#include<stdio.h>
int main()
{
int a,b,sum,sub,mul,div,rem;
printf("Enter first value:");
scanf("%d",&a);
printf("Enter second value:");
scanf("%d",&b);
sum=a+b;
sub=a-b;
mul=a*b;
div=a/b;
rem=a%b;
printf("%d + %d = %d\n",a,b,sum);
printf("%d - %d = %d\n",a,b,sub);
printf("%d * %d = %d\n",a,b,mul);
printf("%d / %d = %d\n",a,b,div);
printf("%d %% %d = %d",a,b,rem);
return 0;
}