Untitled
unknown
plain_text
2 years ago
982 B
6
Indexable
#include <stdio.h>
int main()
{
int a,b;
printf("Hello! \n"); //PRINTING
printf("\n");
printf("Enter two numbers: \n"); //INPUT
scanf("%d",&a);
scanf("%d",&b);
printf(" The first number is: %d \n",a); //PRINTING INPUT
printf("The second number is: %d \n",b);
printf("\n");
int sum = a+b;
printf("The sum of the two numbers is: %d \n",sum );
printf("\n");
//double, float // DATA TYPES
/*
FORMAT SPECIFIERS:
%d - INTEGER (int)
%lf - DOUBLE (double)
%f - FLOAT (float)
%.2d - '%' + '.' + 'number of decimal places' + 'data type format specifier'
*/
double c;
printf("Enter a number: \n");
scanf("%lf",&c);
printf("The double type number input is: %lf \n",c);
printf("The double type number input is: %.0lf \n",c);
/* QUESTION: Write a program to take two double type numbers and print the sum in double type
*/
}Editor is loading...