I would like to output my data in columns with headers.
I looked at some printf escape sequences, but haven't found anything to satisfy me.Is there any way to ensure the data lines up with the headers?
Code:#include <stdio.h> int main(void) { float f,c,t1,t2,duty,period; int r1,r2; printf("Enter value for R1(ohms): "); scanf("%d", &r1); printf("\nEnter value for R2(ohms): "); scanf("%d", &r2); printf("\nEnter value for C(uF): "); scanf("%f", &c); c= c*1E-6; f = 1/(.693*(r1+(2*r2))*c); /* freq(hz) = 1/ .693*(r1+(2*r2))*c */ period = 1/f; t1 = .693*(r1+r2)*c; t2 = .693*r2*c; duty = (t1/period)*100; printf("\nFreq Period T1 T2 Duty Cycle"); printf("\n%fHz fsec% %f %f %f\%%", f, period,t1,t2,duty); return 0; }![]()



LinkBack URL
About LinkBacks



