Question #34015

Write a c++ program to find the sum of 0.123 103 and 0.456 102 and write the result in

three significant digits.

three significant digits.

Expert's answer

#include <stdio.h>

#include <stdlib.h>

//main function

int main(int argc, char *argv[]){

double sum;//variable for sum

sum=0.123+103;//add

printf("%.3f

",sum);//%.3f mean significant digits

sum= 0.456 +102;//add

printf("%.3f

",sum);//%.3f mean significant digits

system("PAUSE");//delay

return 0;

}

#include <stdlib.h>

//main function

int main(int argc, char *argv[]){

double sum;//variable for sum

sum=0.123+103;//add

printf("%.3f

",sum);//%.3f mean significant digits

sum= 0.456 +102;//add

printf("%.3f

",sum);//%.3f mean significant digits

system("PAUSE");//delay

return 0;

}

## Comments

## Leave a comment