CPP
CPP
#include<stdio.h>
void main()
{
printf(“WELCOME TO JNNCE”);
}
#include<stdio.h>
void main()
{
printf(“WELCOME TO JNNCE\n”);
printf(“WELCOME TO C PROGRAMMING”);
}
#include<stdio.h>
void main()
{
printf(“WELCOME TO JNNCE\t MECH\n”);
printf(“WELCOME TO C PROGRAMMING”);
}
#include<stdio.h>
void main()
{
int a,b,c;
a=10;
b=20;
c=a+b;
printf(“ Addition of two numbers c=%d”,c);
}
5. Write C-Program to calculate SUM and Average of three integers
#include<stdio.h>
void main()
{
int a,b,c,sum,avg;
a=10;
b=20;
c= 30;
sum=a+b+c;
avg=sum/3;
printf(“ Sum of three numbers sum=%d”,sum);
printf(“ Average of three numbers avg=%d”,avg);
}
#include<stdio.h>
void main()
{
int a,b,add,sub,mul,div;
a=10;
b=20;
add=a+b;
sub=a-b;
mul=a*b;
div=a/b;
printf(“ Addition of two numbers add=%d\n”,add);
printf(“ Substraction of two numbers sub=%d\n”,sub);
printf(“ Multiplication of two numbers mul=%d\n”,mul);
printf(“ Division of two numbers div=%d”,div);
}
#include<stdio.h>
void main()
{
float a,b,c;
a=10;
b=20;
c=a+b;
printf(“ Addition of two floating point numbers c=%f”,c);
#include<stdio.h>
void main()
{
float a,b,c,sum,avg;
a=10;
b=20;
c=30
sum=a+b+c;
avg=sum/3;
printf(“ Sum of three numbers sum=%f”,sum);
printf(“ Average of three numbers avg=%f”,avg);
}
#include<stdio.h>
void main()
{
int a,b;
printf(“Enter a num \n”);
scanf(“%d”,&a);
printf(“Enter a num \n”);
scanf(“%d”,&b);
}
10.Write C-Program to READ two integers and ADD two integers
#include<stdio.h>
void main()
{
int a,b,add;
printf(“Enter a num \n”);
scanf(“%d”,&a);
printf(“Enter a num \n”);
scanf(“%d”,&b);
add=a+b;
printf(“add=%d”,add);
}
#include<stdio.h>
void main()
{
int a,b,c,sum,avg;
printf(“Enter a num \n”);
scanf(“%d”,&a);
printf(“Enter a num \n”);
scanf(“%d”,&b);
sum=a+b+c;
avg=sum/3;
printf(“ Sum of three numbers sum=%d”,sum);
printf(“ Average of three numbers avg=%d”,avg);
}
12.