Question: What are the five basic data type in c?
Answer: The five basic data type in c are-
- char
- int
- float
- double
- void
Answer:
#include<stdio.h>
int main( )
{int a,b,c;
printf("Enter two integer value");
scanf("%d%d",&a,&b);
c=a+b;
prinntf("%d",c);
return 0;
Question: Write a program that prints the number from 1 to 100.
Answer:
#include<stdio.h>
int main( )
{ int i;
for(i=1;i<=100;i++)
printf("%d",i);
return 0;
}
Question:Write a program that inputs two floating -point numbers (use type float ) and then display their sum.
Answer:
#include<stdio.h>
int main( )
{ float i,n,k;
printf("Enter your numbers");
scanf("%f%f",&i,&n);
k=i+n;
printf("The sum is %f",k);
return 0;
}
Question:Write a program that print 1 through 1000 using for loop.
Answer:
#include<stdio.h>
int main( )
{int i;
printf("The number 1 through 1000 is:");
for(i=1;i<=1000;i++)
printf("%d",i);
return 0;
}