اكتب برنامج C لعرض مكعب الأعداد الطبيعية من 1 حتى عددًا صحيحًا معطى

  • برمجة
  • برمجة سي c

اكتب برنامج C لعرض مكعب الأعداد الطبيعية من 1 حتى عددًا صحيحًا معطى

الخرج المتوقع :

Input number of terms : 5
Number is : 1 and cube of the 1 is :1
Number is : 2 and cube of the 2 is :8
Number is : 3 and cube of the 3 is :27
Number is : 4 and cube of the 4 is :64
Number is : 5 and cube of the 5 is :125

الأجوبة

/*Write a program in C to display the cube of the number upto given an integer*/

#include <stdio.h>
void main()
 {
    int i,ctr;
    printf("Input number of terms : ");
    scanf("%d", &ctr);
    for(i=1;i<=ctr;i++)
    {
	 printf("Number is : %d and cube of the %d is :%d \n",i,i, (i*i*i));     
    }
 }
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...